Skip to content

Commit

Permalink
Add with in README (#65) [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
michadenheijer committed Jul 14, 2021
1 parent e8d8549 commit 60abce7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,15 @@ Optionally you close the ```requests.Session()``` connection with the New York T
nyt.close()
```

### ```with``` usage

If you want to auto close the connection then usage using the ```with``` statement is supported.

```python
with NYTAPI("Your API Key", parse_dates=True) as nyt:
nyt.most_viewed()
```

## License

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
Expand Down

0 comments on commit 60abce7

Please sign in to comment.