mattlisiv / newsapi-python

A Python Client for News API
MIT License
376 stars 130 forks source link

Error using from_parameter #20

Closed asebold closed 4 years ago

asebold commented 5 years ago

The code below errors out:

try:
    newsapi = NewsApiClient(api_key='my key')
    everything = newsapi.get_everything(q='bitcoin',from_parameter='2018-08-01',sources='us',language='en',page_size=100)
except Exception as e:
    print(e)

This is what the exception prints:

get_everything() got an unexpected keyword argument 'from_parameter'

I'm using Python3.6 on Ubuntu 16.04.

asebold commented 5 years ago

Looking through the code, I see the real parameter is "from_param". On the NewsAPI.org site they list an example using "from_parameter". This should be updated. https://newsapi.org/docs/client-libraries/python

mattlisiv commented 5 years ago

Hi @asebold ,

Thanks for pointing this out. As this is not actually an official library, I am not part of the NewsAPI team and do not manage the documentation. @News-API-gh, could you guys take a look at correcting this or if necessary, we can rename the param in the library ?

Thanks, Matt

toxicmender commented 5 years ago

I think this issue can be safely closed for now as @News-API-gh already updated their documentation for keyword argument to from_param in the documentation

sturza commented 5 years ago

This is still not working. When I add the from_param I get the newsapi.newsapi_exception.NewsAPIException

toxicmender commented 5 years ago

This is still not working. When I add the from_param I get the newsapi.newsapi_exception.NewsAPIException

It would be helpful if you could give the traceback you got when trying to run it.

sturza commented 5 years ago

Yes, i found the issue. The news api does not let me filter older news with the free plan. Thank you, you can close the issue. On Mon 8. Jul 2019 at 16:49, Danish notifications@github.com wrote: This is still not working. When I add the from_param I get the newsapi.newsapi_exception.NewsAPIException

It would be helpful if you could give the traceback you got when trying to run it.

?You are receiving this because you commented.Reply to this email directly, view it on GitHub, or mute the thread.

mattlisiv commented 4 years ago

Documentation Updated