pytrends icon indicating copy to clipboard operation
pytrends copied to clipboard

Allow list to be passed as geo

Open sv1990 opened this issue 2 years ago • 4 comments

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

sv1990 avatar Oct 07 '22 08:10 sv1990

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

emlazzarin avatar Oct 31 '22 20:10 emlazzarin

Hi @emlazzarin, I'll look into it later

sv1990 avatar Nov 01 '22 06:11 sv1990

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 avatar Nov 02 '22 09:11 sv1990

I think I fixed it

sv1990 avatar Nov 03 '22 08:11 sv1990

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

sv1990 avatar Apr 22 '23 09:04 sv1990

LGTM, thanks @sv1990 !

Terseus avatar Apr 22 '23 10:04 Terseus

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

AlexYarkin avatar Jun 05 '23 17:06 AlexYarkin

@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.

Terseus avatar Jun 18 '23 18:06 Terseus