This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |