GeneralMills / pytrends

Pseudo API for Google Trends
Other
3.12k stars 798 forks source link

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

Open uzairamer opened 4 months ago

uzairamer commented 4 months ago

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'`