diff options
| author | 2016-03-29 21:05:07 +0100 | |
|---|---|---|
| committer | 2016-03-29 21:05:07 +0100 | |
| commit | 076552c01320bb10ba2dc622c51d2075178cc8f9 (patch) | |
| tree | 765d2be13334962b7ac7d242f8ebcc9d01b28831 /Utils.py | |
| parent | made commands work in channel AND in private message. (diff) | |
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.
Diffstat (limited to 'Utils.py')
| -rw-r--r-- | Utils.py | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -37,6 +37,12 @@ def get_url(url, **kwargs): if post_params: post_params = urllib.parse.urlencode(post_params).encode("utf8") 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.add_header("Accept-Language", "en-US") |
