GeneralMills/pytrends

KeyError: 'content-type' when calling build_payload()

uzairamer opened this issue · 0 comments

Getting the following error when trying to call the build_payload method:
Perhaps google has changed the response?

pytrends.build_payload(keyword, cat=0, timeframe=time_frames[index], geo=geo_location, gprop='') File "/usr/local/lib/python3.12/site-packages/pytrends/request.py", line 169, in build_payload self._tokens() File "/usr/local/lib/python3.12/site-packages/pytrends/request.py", line 175, in _tokens widget_dict = self._get_data( ^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/pytrends/request.py", line 134, in _get_data 'application/javascript' in response.headers['Content-Type'] or \ ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/requests/structures.py", line 52, in __getitem__ return self._store[key.lower()][1] ~~~~~~~~~~~^^^^^^^^^^^^^ KeyError: 'content-type'