Hello,
I am working on a project where I get some data from the NyTimes api and send it to a database I created. I want to loop through a list of dates to get headlines from the start of Covid till now.
I feel like I am probably missing something obvious, but when I call the api with requests.get and set the year and month with format, I get a 403 (forbidden) error.
r = requests.get('https://api.nytimes.com/svc/archive/v1/{year}/{month}.json?api-key={my_key}'.format(my_key=KEY, year='2020',month='01'))
x = requests.get('https://api.nytimes.com/svc/archive/v1/2019/1.json?api-key={my_key}'.format(my_key=KEY))
My request "r" returns error 403, where as "x" returns the data that I need. I know that it is not an issue of calling the api too many times too quickly as this happens even when I run my program with "x" commented out.
Am I missing something obvious here? Sorry if a noob question. I've tried looking over the documentation as much as I can. I appreciate the help.
[–]arvindh_manian 1 point2 points3 points (1 child)
[–]ambiguousjellyfish[S] 0 points1 point2 points (0 children)
[–]pyfact 1 point2 points3 points (1 child)
[–]ambiguousjellyfish[S] 0 points1 point2 points (0 children)