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

The get, post and put core methods do not properly handle absolute URLs #41

Closed
jeffshurtliff opened this issue Aug 25, 2021 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@jeffshurtliff
Copy link
Owner

Describe the bug
The khoros.core.Khoros.get method for performing generic GET requests does not properly handle absolute URLs. Method calls with the relative_url=False parameter fail with an InvalidSchema exception, as demonstrated below.

Note: Error below has been sanitized

>>> response = khoros.get('https://community.example.com/plugins/custom/example/example/custom_endpoint', relative_url=False)
Traceback (most recent call last):
  File "C:\Users\jeffshurtliff\Development\python\venv\lib\site-packages\khoros\api.py", line 228, in get_request_with_retries
    response = requests.get(query_url, headers=headers, verify=verify)
  File "C:\Users\jeffshurtliff\Development\python\venv\lib\site-packages\requests\api.py", line 76, in get
    return request('get', url, params=params, **kwargs)
  File "C:\Users\jeffshurtliff\Development\python\venv\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\jeffshurtliff\Development\python\venv\lib\site-packages\requests\sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\jeffshurtliff\Development\python\venv\lib\site-packages\requests\sessions.py", line 649, in send
    adapter = self.get_adapter(url=request.url)
  File "C:\Users\jeffshurtliff\Development\python\venv\lib\site-packages\requests\sessions.py", line 742, in get_adapter
    raise InvalidSchema("No connection adapters were found for {!r}".format(url))
requests.exceptions.InvalidSchema: No connection adapters were found for '/https://community.example.com/plugins/custom/example/example/custom_endpoint'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Users\jeffshurtliff\Development\python\venv\lib\site-packages\khoros\core.py", line 587, in get
    proxy_user_object=proxy_user_object)
  File "C:\Users\jeffshurtliff\Development\python\venv\lib\site-packages\khoros\api.py", line 231, in get_request_with_retries
    _report_failed_attempt(exc_msg, 'get', retries)
  File "C:\Users\jeffshurtliff\Development\python\venv\lib\site-packages\khoros\api.py", line 400, in _report_failed_attempt
    raise Exception(f"{_exc_name}: {_exc_msg}")
Exception: InvalidSchema: No connection adapters were found for '/https://community.example.com/plugins/custom/example/example/custom_endpoint'

Affected version

>>> khoros.version
'4.1.1'
@jeffshurtliff jeffshurtliff added the bug Something isn't working label Aug 25, 2021
@jeffshurtliff jeffshurtliff added this to the v4.2.0 milestone Aug 25, 2021
@jeffshurtliff jeffshurtliff self-assigned this Aug 25, 2021
@jeffshurtliff jeffshurtliff added this to To do in 2021 Roadmap via automation Aug 25, 2021
@jeffshurtliff jeffshurtliff changed the title The khoros.core.Khoros.get method does not properly handle absolute URLs The get, post and put core methods do not properly handle absolute URLs Aug 29, 2021
@jeffshurtliff
Copy link
Owner Author

Updated the title as this issue also occurs with the post and put core methods.

@jeffshurtliff
Copy link
Owner Author

This is now resolved in v4.2.0

2021 Roadmap automation moved this from In development to Done Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
No open projects
2021 Roadmap
  
Done
Development

No branches or pull requests

1 participant