当使用pyTrends时,我得到以下错误。TypeError:__init__() 缺少两个必要的位置参数。'google_username' 和 'google_password' 。

0 人关注

错误信息。

TypeError                                 Traceback (most recent call last)
<ipython-input-2-3034775b0776> in <module>
      6 # Create a Google Trend Object
----> 8 totalTrend = TrendReq(hl='en-US', tz=360)
     10 # Declare a var to store the search term
TypeError: __init__() missing 2 required positional arguments: 'google_username' and 'google_password'

我不知道在哪里可以输入我的谷歌用户名和谷歌密码,以便正确访问gTrends。

python
user12884542
user12884542
发布于 2020-02-12
1 个回答
Chrisvdberge
Chrisvdberge
发布于 2020-02-12
已采纳
0 人赞同

从文件/例子中可以看出,你需要先初始化连接和登录。

# Login to Google. Only need to run this once, the rest of requests will use the same session.
pytrend = TrendReq()