mattlisiv / newsapi-python

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

Syntax Error #37

Closed vpolimenov closed 5 years ago

vpolimenov commented 5 years ago

Hello,

just installed the package and got the following error:

  File "<stdin>", line 1, in <module>
  File "/anaconda3/envs/ff/lib/python3.6/site-packages/newsapi/__init__.py", line 1, in <module>
    from newsapi.newsapi_client import NewsApiClient
  File "/anaconda3/envs/ff/lib/python3.6/site-packages/newsapi/newsapi_client.py", line 12
    def get_top_headlines(self, q=None: str, sources=None: str, language='en': str, country=None: str, category=None: str, page_size=20: int,
                                      ^
SyntaxError: invalid syntax

I can see the change coming in from this PR.

Do I need a specific version of something or am I missing something else?

Thanks in advance.

EDIT:

Just tested it with version 0.2.3 and I can confirm that it's working. So presumably the whole thing blowed up 2 hours ago, when the version was bumped. 👼

davecom commented 5 years ago

Yes, I am running into the same thing on Python 3.7. I believe the issue here is that the type hints with default values are backwards. It should be q: str = None, sources: str = None, etc.

Sorry to bother @mattlisiv again, but it looks like users will need another version bump and this one is more urgent.

davecom commented 5 years ago

Also, the PyPI versions of Python that this is compatible with are no longer correct due to the type hints. 3.6, 3.7 should be added and some of the current versions listed should be removed I think.

mattlisiv commented 5 years ago

ok my bad. I shouldve paid more attention. I reverted the type hints. Install 0.2.5 and let me know if you still have issues

davecom commented 5 years ago

Thanks, @mattlisiv. Things look better.

vpolimenov commented 5 years ago

Yes, better! Thank you very much 👍