You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've tried to replicate this in Python 2.7.17 and 3.7.4 with the following results.
python3:
I started with Python 3 because I am more familiar with it. The snippet you've supplied works as expected with a caveat; are you using a free plan? If so, you will get the following exception:
Traceback (mostrecentcalllast):
File"/home/daniel/Code/junkyard/newsapi_test.py", line12, in<module>page=2)
File"/home/daniel/.virtualenvs/scripts/lib/python3.7/site-packages/newsapi/newsapi_client.py", line261, inget_everythingraiseNewsAPIException(r.json())
newsapi.newsapi_exception.NewsAPIException: {'status': 'error', 'code': 'parameterInvalid', 'message': 'You are trying to request results too far in the past. Your plan permits you to request articles as far back as 2019-09-26, but you have requested 2018-10-01. To extend this please upgrade to a paid plan.'}
Adjusting the from_param and to within the allowable date range returns as expected.
python2:
Running the same all_articles command returns the exception as detailed by @reshu-b7
Without doing much more investigation than that, I would suggest it is a case of the exception not raising as expected in Python 2 and leaving the user guessing as to the problem.
While trying to run the following code snippet , which is actually a part of documentation :
I am getting this error again and again :
Any suggestions on why this might be happening ?
The text was updated successfully, but these errors were encountered: