Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix requests_args usage for multiple methods #518

Merged
merged 1 commit into from
Jun 10, 2022

Conversation

avant1
Copy link
Contributor

@avant1 avant1 commented Jun 9, 2022

request_args are passed twice in _get_data() for some methods:

  • directly as **self.requests_args
  • via **kwargs

This leads to the following error:

  File "/usr/local/lib/python3.9/site-packages/pytrends/request.py", line 527, in suggestions
    req_json = self._get_data(
  File "/usr/local/lib/python3.9/site-packages/pytrends/request.py", line 138, in _get_data
    response = s.get(url, timeout=self.timeout, cookies=self.cookies,
TypeError: requests.sessions.Session.get() got multiple values for keyword argument 'headers'

This PR fixes #448, fixes #513

'User-Agent': 'pytrends',
}}
pytrend = TrendReq(requests_args=requests_args)
pytrend.build_payload(kw_list=['bananas'])
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this call is not needed, but other tests have it, so I left it here too.

@emlazzarin emlazzarin merged commit 706975c into GeneralMills:master Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants