mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
Throw InvalidURL not UnicodeError on bad label.
This commit is contained in:
+4
-1
@@ -413,7 +413,10 @@ class Request(object):
|
||||
if not scheme in SCHEMAS:
|
||||
raise InvalidSchema("Invalid scheme %r" % scheme)
|
||||
|
||||
netloc = netloc.encode('idna').decode('utf-8')
|
||||
try:
|
||||
netloc = netloc.encode('idna').decode('utf-8')
|
||||
except UnicodeError:
|
||||
raise InvalidURL('URL has an invalid label.')
|
||||
|
||||
if not path:
|
||||
path = '/'
|
||||
|
||||
Reference in New Issue
Block a user