Skip to content

Instantly share code, notes, and snippets.

View joshzyj's full-sized avatar
💭
I may be slow to respond.

Yongjun Zhang joshzyj

💭
I may be slow to respond.
View GitHub Profile
@joshzyj
joshzyj / get_NYT_archive_data.py
Created January 13, 2023 15:44 — forked from brienna/get_NYT_archive_data.py
Requests article data from The New York Times Archive API over a period time
def send_request(date):
'''Sends a request to the NYT Archive API for given date.'''
base_url = 'https://api.nytimes.com/svc/archive/v1/'
url = base_url + '/' + date[0] + '/' + date[1] + '.json?api-key=' + YOUR_API_KEY
response = requests.get(url).json()
time.sleep(6)
return response
def is_valid(article, date):