pytrends icon indicating copy to clipboard operation
pytrends copied to clipboard

Script I made was working before, now it shows Read Timeout error

Open rmusngi opened this issue 4 years ago • 23 comments

Hi, I have been using a script to get Google Trends data but today it suddenly showed this error HTTPSConnectionPool(host='trends.google.com', port=443): Read timed out. (read timeout=5)

Is it a problem in my code or somewhere else?

rmusngi avatar Feb 16 '21 13:02 rmusngi

I'm also having the same problem : \

YohanDhana avatar Feb 18 '21 04:02 YohanDhana

same here, likely google modified their api proxy policy, I'm going to see if sleeping longer can avoid this issue.

QimanWang avatar Feb 18 '21 16:02 QimanWang

I'm having the exact same problem. First the time out error now the 429 error.

burton030 avatar Feb 22 '21 08:02 burton030

same here, has anyone been able to fix it?

anjadevries avatar Feb 22 '21 13:02 anjadevries

I made the timeout 10,25 but it made the script run so slow :(

rmusngi avatar Feb 22 '21 13:02 rmusngi

This does not work for me.

burton030 avatar Feb 22 '21 15:02 burton030

Also have this same issue, sleeping longer has not done much. Has anyone had success in fixing this?

tylercroberts avatar Feb 22 '21 19:02 tylercroberts

Same issue here. Are you all using AWS or something? I've run it once on my local PC and it ran smoothly but on aws I'm getting 429.

iJohnMaged avatar Feb 23 '21 00:02 iJohnMaged

Same issue here on my pc and on AWS. AWS instance has been blocked for over 10 days. 2 other computers I tried started right from the get go with timeouts.

cmeier303 avatar Feb 25 '21 20:02 cmeier303

I am getting the same error running this from my pizero from my home.

EDIT: I disabled my Pi-Hole software running on another device and it seemed to work for one trend pull. I went to the Google Trends page and any trend I was searching was not loading. I disabled the Pi-Hole software and searches started working. Rebooted my pizero and ran my script to pull 70 trends and it competed the first and spat out the error again on the second pull.

Korpip avatar Feb 25 '21 23:02 Korpip

Same problem here, it has been three days since I am getting error 429 on my EC2 instance. A greater sleep or timeout has not resolved the problem.

silviacamplani avatar Feb 26 '21 11:02 silviacamplani

I got the same problem and narrowed it down to the related_queries() function. Other functions seem to be working well. Hope to see a solution for it anytime soon!

philippschmalen avatar Feb 27 '21 16:02 philippschmalen

I got the same problem and narrowed it down to the related_queries() function. Other functions seem to be working well. Hope to see a solution for it anytime soon!

Nope. All others same issue.

iJohnMaged avatar Feb 27 '21 19:02 iJohnMaged

Same issue here. Are you all using AWS or something? I've run it once on my local PC and it ran smoothly but on aws I'm getting 429.

@iJohnMaged I'm just curious but did you made too many requests before getting 429 on your AWS instance?

silviacamplani avatar Mar 03 '21 14:03 silviacamplani

Same issue here. Are you all using AWS or something? I've run it once on my local PC and it ran smoothly but on aws I'm getting 429.

@iJohnMaged I'm just curious but did you made too many requests before getting 429 on your AWS instance?

Nope. I started getting it on my 3rd request, locally I can get away with 2500 requests before getting any 429s and sleeping for 60s solves it.

iJohnMaged avatar Mar 03 '21 20:03 iJohnMaged

Reporting similar issue from AWS - multiple regions tested in EU and US with new public IPs, all to the same result: only 1-3 requests allowed per period, the rest end up with a 429 - local seems to be just like before. It would appear google has decided to severely restrict AWS IP ranges from using the service.

guareber avatar Mar 08 '21 12:03 guareber

Do you think it'll still be throttled to 3 requests/min if you move to GCP?

dev-dimsum avatar Mar 13 '21 11:03 dev-dimsum

Do you think it'll still be throttled to 3 requests/min if you move to GCP?

Working fine on GCP :)

iJohnMaged avatar Mar 13 '21 15:03 iJohnMaged

@iJohnMaged How many request can be send from GCP?

Could be that this limit is only applied to AWS??? Is this 2-3 request per minute visible somewhere???? or is just known now by trrial and error (reported experience)?

I thought this was a different error than the 429 reported time a go https://github.com/GeneralMills/pytrends/issues/435

Also How many time do I need to sleep between request? 1 minute or 1 hour? or it varies?

tyoc213 avatar Mar 18 '21 17:03 tyoc213

@iJohnMaged How many request can be send from GCP?

Could be that this limit is only applied to AWS??? Is this 2-3 request per minute visible somewhere???? or is just known now by trrial and error (reported experience)?

I thought this was a different error than the 429 reported time a go #435

Also How many time do I need to sleep between request? 1 minute or 1 hour? or it varies?

I think I'm getting about 2.5~3K on GCP almost with 5 seconds + random delay.

On AWS it's completely blocked, from the first request, at least for me.

iJohnMaged avatar Mar 18 '21 20:03 iJohnMaged

Having similar issues - running on AWS and no luck but works sporadically on local.

Anyone on aws having any luck?

AndyMcGowan avatar Mar 19 '21 10:03 AndyMcGowan

Yes I am also facing the same issue. When run locally, it works fine. But on AWS server I keep getting the 429 error. So is this problem due to the AWS? Does anyone face this issue on GCP?

kalagee-anjaria avatar Mar 25 '21 08:03 kalagee-anjaria

I'm hitting 429s on GCP.....

It's running (20 + random) seconds between requests and get's blocked within 10ish hours....

EDIT:

I got with working by dropping the parameters when setting up TrendReq and increasing my delay to 60 seconds:

Change this -

pytrends = TrendReq(hl='en-US', tz=360)

To this -

pytrends = TrendReq()

AWS was still blocked from the first request.

corbanvilla avatar May 09 '21 20:05 corbanvilla