I'm trying to run a script using pytrends library to scrape Google Trends.
import pytrends
kw_list = ["covid"]
pytrends.build_payload(kw_list, cat=0, timeframe='2021-02-01 2021-07-09', geo='BR', gprop='')
gt_o3_ytd1 = pytrends.interest_over_time()
I'm getting the following error message:
AttributeError Traceback (most recent call last)
<ipython-input-4-e6a3a9855c66> in <module>
2
3 kw_list = ["covid"]
----> 4 pytrends.build_payload(kw_list, cat=0, timeframe='2021-02-01 2021-07-09', geo='BR', gprop='')
5 gt_o3_ytd1 = pytrends.interest_over_time()
AttributeError: module 'pytrends' has no attribute 'build_payload'
# import the TrendReq method from the pytrends request module
from pytrends.request import TrendReq
# execute the TrendReq method by passing the host language (hl) and timezone (tz) parameters
pytrends = TrendReq(hl='en-US', tz=360)
kw_list = ["covid"]
pytrends.build_payload(kw_list, cat=0, timeframe='2021-02-01 2021-07-09', geo='BR', gprop='')
gt_o3_ytd1 = pytrends.interest_over_time()
gt_o3_ytd1