pytrends icon indicating copy to clipboard operation
pytrends copied to clipboard

Error with all request: HTTPSConnectionPool(host='trends.google.com', port=443): Max retries exceeded

Open dteite opened this issue 1 year ago • 17 comments

Error: requests.exceptions.RetryError: HTTPSConnectionPool(host='trends.google.com', port=443): Max retries exceeded with url: /trends/api/widgetdata/multiline?req=%7B%22time%22%3A+%222019-01-09+2024-01-09%22%2C+%22resolution%22%3A+%22WEEK%22%2C+%22locale%22%3A+%22fr%22%2C+%22comparisonItem%22%3A+%5B%7B%22geo%22%3A+%7B%7D%2C+%22complexKeywordsRestriction%22%3A+%7B%22keyword%22%3A+%5B%7B%22type%22%3A+%22BROAD%22%2C+%22value%22%3A+%22Blockchain%22%7D%5D%7D%7D%5D%2C+%22requestOptions%22%3A+%7B%22property%22%3A+%22%22%2C+%22backend%22%3A+%22IZG%22%2C+%22category%22%3A+0%7D%2C+%22userConfig%22%3A+%7B%22userType%22%3A+%22USER_TYPE_SCRAPER%22%7D%7D&token=APP6_UEAAAAAZZ5nibSrd7eGFaW6zIrTCcwnlMaBCZpn&tz=360 (Caused by ResponseError('too many 429 error responses'))

Example:

pytrends = TrendReq(
        hl="fr-FR",
        tz=360,
        timeout=(10, 25),
        retries=2,
        backoff_factor=1,
        requests_args={"verify": False},
    )
    kw_list = ["Blockchain"]
    pytrends.build_payload(kw_list, cat=0, timeframe='today 5-y', geo='', gprop='')
    pytrends.interest_over_time()

dteite avatar Jan 09 '24 09:01 dteite

Same problem today even with the use of proxies...

pentarix1996 avatar Jan 09 '24 12:01 pentarix1996

Same problem over here.

williamegomezo avatar Jan 09 '24 13:01 williamegomezo

Same here.

andrebuhler avatar Jan 09 '24 19:01 andrebuhler

me too. It was working fine last week, but the past two days its been instant 429 error.

Nicole-Yancy avatar Jan 10 '24 00:01 Nicole-Yancy

Me too, it happened recently, a week ago it was fine, even after using proxies it do not work. It looks like I have to use selenium driver to make it work, I need to edit the package itself.

AhmadKhanSenpai avatar Jan 10 '24 05:01 AhmadKhanSenpai

Saturday 6 January was the last time it worked for me. This error has occurred persistently since then.

cooperjaXC avatar Jan 11 '24 00:01 cooperjaXC

For me, 2024-01-05 10:20:31 (+03:00) was the last

andrebuhler avatar Jan 11 '24 01:01 andrebuhler

2024-01-07 worked for me, but 2024-01-08 failed

dteite avatar Jan 11 '24 08:01 dteite

2024.01.06 @ 09:41 AM UTC was the last time it worked for me at all. What happened?

aardvark123456789 avatar Jan 11 '24 18:01 aardvark123456789

I did a lot of reverse engineering and found the following:

  • There is one endpoint that changed and then is returning 404. {BASE_TRENDS_URL}/explore/?geo={self.hl[-2:]} is now {TrendReq.GENERAL_URL}/pickers/geo?hl={self.hl}

  • The token generated by google trends is user type: user scrapper. This is because the recaptcha badge included. So probably this is not going to work again until we solve recaptcha validation. And to be honest is complex, it is sending right now a payload that I could not decoded to {BASE_TRENDS_URL}/api/explore, so there is no way to get a valid token.

  • I opted to use better my custom selenium code, and it is working well. More ram and resources, but it is a temporary solution.

williamegomezo avatar Jan 11 '24 21:01 williamegomezo

I think it magically worked again, am I the only one that works again?

pentarix1996 avatar Jan 22 '24 09:01 pentarix1996

I think it magically worked again, am I the only one that works again?

It also started working for me again as well!

cooperjaXC avatar Jan 22 '24 19:01 cooperjaXC

@pentarix1996 how did it start work again?

Rupin817 avatar Feb 26 '24 18:02 Rupin817

May I ask if anyone encountered the following error starting from this week, it was working previously:

requests.exceptions.RetryError: HTTPSConnectionPool(host='trends.google.com', port=443): Max retries exceeded with url: ..... (Caused by ResponseError('too many 429 error responses'))

Edricklam123 avatar Feb 29 '24 16:02 Edricklam123

May I ask if anyone encountered the following error starting from this week, it was working previously:

requests.exceptions.RetryError: HTTPSConnectionPool(host='trends.google.com', port=443): Max retries exceeded with url: ..... (Caused by ResponseError('too many 429 error responses'))

yes it is few days that I also get this error even using proxy does not help, has anyone found a solution for this issue?

mahdikhojasteh avatar Mar 02 '24 13:03 mahdikhojasteh

Has anyone already resolved this issue?

wawankurniawan avatar Mar 19 '24 02:03 wawankurniawan

Any news on that?

qo4on avatar Jun 23 '24 04:06 qo4on