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

TypeError when passing self.verify as a boolean to request.get() in APIClient.get_session() #669

Closed
1 of 4 tasks
TheColdIce opened this issue Aug 13, 2024 · 2 comments
Closed
1 of 4 tasks

Comments

@TheColdIce
Copy link

Severity

  • Critical/Blocker (select if the issue makes the application unusable or causes serious data loss)
  • High (select if the issue affects a major feature and there is no workaround or the available workaround is very complex)
  • Medium (select if the issue affects a minor feature or affects a major feature but has an easy enough workaround to not cause any major inconvenience)
  • Low (select if the issue doesn't significantly affect the user experience, like minor visual bugs)

Describe the bug
When calling APIClient.get_session() I get a TypeError("Cannot mix str and non-str arguments"). After some debugging I found a fix by converting the boolean self.verify to a string with str(self.verify).

Environment:

  • OS: [Ubuntu]
  • Version: [Ubuntu 22.04.4 LTS]

Reproduction Steps
Steps to reproduce the behavior:

  1. Create a APIClient
  2. Start a session
  3. Call get_session()

Expected behavior
Return a dict with the session info.

Screenshots
None.

Contact Details
None.

@TheColdIce
Copy link
Author

Acutely, the fix should probably be to add "verify=" as your other functions look like? So the line is:

response = requests.get(self._get_url_api_v1(f"sessions/{id}"), verify=self.verify, headers=self.headers)

and not:

response = requests.get(self._get_url_api_v1(f"sessions/{id}"), self.verify, headers=self.headers)

@FrankJonasmoelle
Copy link
Contributor

Your comment is correct, "verify" is a keyword argument, "self.verify" should therefore not be passed as a positional argument. "response = requests.get(self._get_url_api_v1(f"sessions/{id}"), verify=self.verify, headers=self.headers)" fixes the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants