This commit is contained in:
j 2014-10-04 21:07:18 +02:00
parent a3c470847d
commit f630877098

View file

@ -51,7 +51,7 @@ def open_url(url, data=None, headers=DEFAULT_HEADERS):
if isinstance(url, bytes):
url = url.decode('utf-8')
url = url.replace(' ', '%20')
if PY3 and not isinstance(data, bytes):
if data and PY3 and not isinstance(data, bytes):
data = data.encode('utf-8')
req = urllib.request.Request(url, data, headers)
return urllib.request.urlopen(req)