fix: error with empty GET urls

This commit is contained in:
Maks Snegov 2014-06-23 00:50:21 +04:00
parent 594ff71991
commit 6a818f4bb4

View File

@ -56,7 +56,8 @@ def download_content(url, depth=0):
else: else:
raise NotImplementedError("protocol %s is not implemented" % up.scheme) raise NotImplementedError("protocol %s is not implemented" % up.scheme)
conn.request("GET", '?'.join((up.path, up.query)), None, headers) requrl = ('?'.join((up.path, up.query)) if up.query else up.path) or '/'
conn.request("GET", requrl, None, headers)
response = conn.getresponse() response = conn.getresponse()
# follow redirects # follow redirects