error:The request failed: Google returned a response with code 429.
riukenn opened this issue · 4 comments
code:
from pytrends.request import TrendReq
import pandas as pd
pytrends = TrendReq(hl='en-US', tz=360)
pytrends.build_payload(['maple'], timeframe='2021-05-09 2021-09-15', gprop='', geo='')
df = pytrends.interest_over_time()
print(df)
The program ran normally 5 hours ago. But now running the program will report an error.
error code:
pytrends.exceptions.ResponseError: The request failed: Google returned a response with code 429.
I'm currently using version 4.7.3,Who can tell me how to solve this problem, please
Error code 429 means you've hit the rate limit of Google trends. You'll have to wait a while to be allowed access. It could be an hour, it could be a day, I'm not sure.
In my experience it often is a few hours to 1 day.
You could use a proxy list to bypass this problem. Or if you have a manageable size you can simply restart your router to get a new public IP. This way Google won't know you.
Fixed by #553.
I try another methods may be useful, which is switch off WIFI connection and open it again.
Then codes could run.