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

requests 2.12+ breaks client api url #199

Closed
uSpike opened this issue Nov 16, 2016 · 2 comments
Closed

requests 2.12+ breaks client api url #199

uSpike opened this issue Nov 16, 2016 · 2 comments

Comments

@uSpike
Copy link

uSpike commented Nov 16, 2016

See https://github.com/kennethreitz/requests/issues/3687 and msabramo/requests-unixsocket#24

Simply trying to create a Client() instance causes:

Traceback (most recent call last):
  File "/home/xxx/new/ansible-test-suite/venv/lib/python3.5/site-packages/requests/packages/idna/core.py", line 327, in uts46_remap
    raise IndexError()
IndexError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/xxx/new/ansible-test-suite/venv/lib/python3.5/site-packages/requests/models.py", line 370, in prepare_url
    host = idna.encode(host, uts46=True).decode('utf-8')
  File "/home/xxx/new/ansible-test-suite/venv/lib/python3.5/site-packages/requests/packages/idna/core.py", line 340, in encode
    s = uts46_remap(s, std3_rules, transitional)
  File "/home/xxx/new/ansible-test-suite/venv/lib/python3.5/site-packages/requests/packages/idna/core.py", line 332, in uts46_remap
    _unot(code_point), pos + 1, repr(domain)))
requests.packages.idna.core.InvalidCodepoint: Codepoint U+0025 not allowed at position 1 in '%2fvar%2flib%2flxd%2funix.socket'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/xxx/new/ansible-test-suite/venv/lib/python3.5/site-packages/pylxd/client.py", line 204, in __init__
    response = self.api.get()
  File "/home/xxx/new/ansible-test-suite/venv/lib/python3.5/site-packages/pylxd/client.py", line 100, in get
    self._api_endpoint, *args, **kwargs)
  File "/home/xxx/new/ansible-test-suite/venv/lib/python3.5/site-packages/requests/sessions.py", line 501, in get
    return self.request('GET', url, **kwargs)
  File "/home/xxx/new/ansible-test-suite/venv/lib/python3.5/site-packages/requests/sessions.py", line 474, in request
    prep = self.prepare_request(req)
  File "/home/xxx/new/ansible-test-suite/venv/lib/python3.5/site-packages/requests/sessions.py", line 407, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/home/xxx/new/ansible-test-suite/venv/lib/python3.5/site-packages/requests/models.py", line 302, in prepare
    self.prepare_url(url, params)
  File "/home/xxx/new/ansible-test-suite/venv/lib/python3.5/site-packages/requests/models.py", line 372, in prepare_url
    raise InvalidURL('URL has an invalid label.')
requests.exceptions.InvalidURL: URL has an invalid label.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "mkcontainer.py", line 8, in <module>
    client = pylxd.Client()
  File "/home/xxx/new/ansible-test-suite/venv/lib/python3.5/site-packages/pylxd/client.py", line 211, in __init__
    raise exceptions.ClientConnectionFailed()
pylxd.exceptions.ClientConnectionFailed

I'm only filing this ticket to raise awareness of the issue. I think the resolution lies upstream.

@rockstar
Copy link
Contributor

I've also noticed this, and have pinned the requests version to <2.12 in master (which will go out as 2.1.3)

Thanks for the report. I intend to see if I can track it down wherever the issue is, as it's still a sub-optimal experience for pylxd users.

@matheo
Copy link

matheo commented Nov 22, 2016

I didn't got the 2.1.3 part. Local client works with 2.11.1.

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

3 participants