added code to Utils.get_url to prevent non-iso-latin-1 urls being attempted. I need to put in a better fix than this at some point.
This commit is contained in:
parent
57a0e2f10f
commit
076552c013
1 changed files with 6 additions and 0 deletions
6
Utils.py
6
Utils.py
|
@ -37,6 +37,12 @@ def get_url(url, **kwargs):
|
||||||
if post_params:
|
if post_params:
|
||||||
post_params = urllib.parse.urlencode(post_params).encode("utf8")
|
post_params = urllib.parse.urlencode(post_params).encode("utf8")
|
||||||
url = "%s%s" % (url, get_params)
|
url = "%s%s" % (url, get_params)
|
||||||
|
try:
|
||||||
|
url.encode("latin-1")
|
||||||
|
except UnicodeEncodeError:
|
||||||
|
if kwargs.get("code"):
|
||||||
|
return 0, False
|
||||||
|
return False
|
||||||
|
|
||||||
request = urllib.request.Request(url, post_params)
|
request = urllib.request.Request(url, post_params)
|
||||||
request.add_header("Accept-Language", "en-US")
|
request.add_header("Accept-Language", "en-US")
|
||||||
|
|
Loading…
Reference in a new issue