首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >ResponseError:请求失败: Google返回了代码400的响应

ResponseError:请求失败: Google返回了代码400的响应
EN

Stack Overflow用户
提问于 2020-11-12 22:44:34
回答 1查看 2.2K关注 0票数 2

我试图搜索“冠状病毒”这个词的发展趋势,并寻找代码:

代码语言:javascript
运行
复制
import pandas as pd                        
from pytrends.request import TrendReq

pytrend = TrendReq()


pytrend.build_payload(kw_list=['sintomas covid'],timeframe='2020-02-26 today', geo='BR')
 
# Interest Over Time
interest_over_time_df = pytrend.interest_over_time()

我一直得到:

代码语言:javascript
运行
复制
ResponseError: The request failed: Google returned a response with code 400.

已经试过this了。

EN

回答 1

Stack Overflow用户

发布于 2021-05-19 14:45:40

由于时间框架参数,它应该是下列格式之一

特定日期,'YYYY-MM-DD YYYY-MM-DD‘2016-12-14 2017-01-25'

  • Specific dates,'YYYY-MM-DDTHH YYYY MM-DDTHH’示例'2017-02-06T10 2017-02-12T07'

您可以在用例中使用此代码。

代码语言:javascript
运行
复制
import pandas as pd      
from datetime import date
from pytrends.request import TrendReq

pytrend = TrendReq()


pytrend.build_payload(kw_list=['sintomas covid'],timeframe=f'2020-02-26 {date.today()}', geo='BR')
 
# Interest Over Time
pytrend.interest_over_time()
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64812934

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档