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

valueerror when unquoting bad url #1510

Closed
errx opened this Issue Aug 1, 2013 · 3 comments

Comments

Projects
None yet
3 participants
@errx

errx commented Aug 1, 2013

Maybe it should return another error?

>>> requests.get("http://%zz")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 55, in get
    return request('get', url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 324, in request
    prep = req.prepare()
  File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 222, in prepare
    p.prepare_url(self.url, self.params)
  File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 333, in prepare_url
    url = requote_uri(urlunparse([scheme, netloc, path, None, query, fragment]))
  File "/usr/local/lib/python2.7/dist-packages/requests/utils.py", line 383, in requote_uri
    return quote(unquote_unreserved(uri), safe="!#$%&'()*+,/:;=?@[]~")
  File "/usr/local/lib/python2.7/dist-packages/requests/utils.py", line 364, in unquote_unreserved
    c = chr(int(h, 16))
ValueError: invalid literal for int() with base 16: 'zz'
@Lukasa

This comment has been minimized.

Show comment
Hide comment
@Lukasa

Lukasa Aug 2, 2013

Member

Thanks for raising this! We should be handling it as part of 2.0: see #1514. =)

Member

Lukasa commented Aug 2, 2013

Thanks for raising this! We should be handling it as part of 2.0: see #1514. =)

@Lukasa Lukasa closed this Aug 2, 2013

@julienbou
@Lukasa

This comment has been minimized.

Show comment
Hide comment
@Lukasa

Lukasa Aug 10, 2013

Member

Yeah, that's an invalid URL in the second case: %u00e0 is not a valid string in a URI.

Member

Lukasa commented Aug 10, 2013

Yeah, that's an invalid URL in the second case: %u00e0 is not a valid string in a URI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment