GeneralMills/pytrends

Too many 429 error responses. Max retries exceeded. #578

MohammedN-hash opened this issue · 3 comments

related keywords:An error occurred while fetching related queries: The request failed: Google returned a response with code 429

Are you using proxies? I'm starting to think that this issue only occurs when you use proxies. I wonder if it has something to do with the way we're using cookies for each proxy

I am not using any proxies, this is the code I have:

pytrend = TrendReq()

def related_suggestions_queries(term,language):

    pytrend = TrendReq(hl=language)

    pytrend.build_payload(kw_list=[term])

    related_terms = pytrend.related_queries()

    return related_terms 

could it be a problem with the rate limit? because sometimes it works sometimes not? is there a way to avoid the rate limit if it is the issue here?

The error code 429 indicates that your requests to the Google Trends API have exceeded the rate limit. To resolve this issue, you can Introduce a delay between requests or Reduce the number of requests or use batch processing or simply use proxies (pytrends = TrendReq(hl='en-US', tz=360, proxies=['your working proxy']) )