我正在使用Pytrends来提取Google趋势数据,例如:
from pytrends.request import TrendReq
pytrend = TrendReq()
pytrend.build_payload(kw_list=['bitcoin'], cat=0, timeframe=from_date+' '+today_date)
并返回一个错误:
ResponseError: The request failed: Google returned a response with code 429.
我昨天做的,但由于某种原因,它现在不能工作!来自github的源代码也失败了:
pytrends = TrendReq(hl='en-US', tz=360, proxies = {'https': 'https://34.203.233.13:80'})
我该如何解决这个问题呢?非常感谢!
发布于 2020-06-11 19:56:25
即使在使用pip install --upgrade --user git+https://github.com/GeneralMills/pytrends
更新模块并重新启动python之后,我也遇到了同样的问题。
但是,通过以下方法解决了这个问题:
而不是
pytrends = TrendReq(hl='en-US', tz=360, timeout=(10,25), proxies=['https://34.203.233.13:80',], retries=2, backoff_factor=0.1, requests_args={'verify':False})
只是跑了一下:
pytrend = TrendReq()
希望这能对大家有所帮助!
https://stackoverflow.com/questions/50571317
复制相似问题