GeneralMills / pytrends

Pseudo API for Google Trends
Other
3.23k stars 817 forks source link

Allow list to be passed as geo #533

Closed sv1990 closed 1 year ago

sv1990 commented 1 year ago

This allows passing multiple regions to be requested for the same keyword. This fixes #352.

emlazzarin commented 1 year ago

@sv1990 are you okay rebasing this and reconfiguring a bit to match the new testing system?

sv1990 commented 1 year ago

Hi @emlazzarin, I'll look into it later

sv1990 commented 1 year ago

I think I messed up the rebase. The actual diff can be seen here.

Should I maybe open a new pull request in the hope that github doesn't think anymore that I changed 34 files?

sv1990 commented 1 year ago

I think I fixed it

sv1990 commented 1 year ago

I had to change the values in the unrelated test test_interest_by_region_city_resolution so that all tests are now passing for me locally

Terseus commented 1 year ago

LGTM, thanks @sv1990 !

AlexYarkin commented 1 year ago

Hi there! I think I still can't pas a list into geo, see below:

pytrends = TrendReq() pytrends.build_payload(kw_list=['pizza'], geo=['US-NY', 'US-IL']) df = pytrends.interest_over_time()

Traceback (most recent call last):

File "C:\Users\alexandery\AppData\Local\Temp\ipykernel_37688\2385922720.py", line 2, in pytrends.build_payload(kw_list=['pizza'], geo=['US-NY', 'US-IL'])

File "C:\Users\alexandery\AppData\Roaming\Python\Python39\site-packages\pytrends\request.py", line 189, in build_payload self._tokens()

File "C:\Users\alexandery\AppData\Roaming\Python\Python39\site-packages\pytrends\request.py", line 195, in _tokens widget_dicts = self._get_data(

File "C:\Users\alexandery\AppData\Roaming\Python\Python39\site-packages\pytrends\request.py", line 160, in _get_data raise exceptions.ResponseError.from_response(response)

ResponseError: The request failed: Google returned a response with code 400

Any suggestions would be welcome! Thanks a lot

Terseus commented 1 year ago

@AlexYarkin I just checked and the feature still works for me, if you can provide a minimal reproducible example please open a new issue referencing this PR.