pynytimes
  • Introduction to pynytimes
  • Getting Started
    • Installation
    • Usage
    • Citation
  • Search
    • Article Search
    • Book Reviews
    • Movie Reviews
  • Popular
    • Top Stories
    • Most Viewed
    • Most Shared
    • Best Sellers Lists
  • Metadata
    • Article Metadata
    • Archive Metadata
    • Latest Articles
  • Other
    • Tags
  • Advanced Usage
    • Close Connection
    • Automatic Connection
  • Repository
  • PyPI
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
  1. Getting Started

Usage

PreviousInstallationNextCitation

Last updated 2 years ago

Was this helpful?

You can easily import this library using:

from pynytimes import NYTAPI

Then you can simply add your API key (get your API key from ):

nyt = NYTAPI("Your API key", parse_dates=True)

Make sure that if you commit your code to GitHub you .

The following parameters can be set, only the key parameter is required.

Parameters

Variables
Description
Data type
Required
Default

key

The API key from

str

True

None

https

Use

bool

False

True

session

Optionally set your own request.session

requests.sessions.Session

False

requests.Session()

backoff

Enable

bool

False

True

user_agent

Set the

str

False

pynytimes/[version]

parse_dates

Enable the parsing of dates into datetime.datetime or datetime.date objects

bool

False

False

The New York Times Dev Portal
don't accidentially commit your API key
The New York Times
HTTPS
exponential backoff
User Agent