mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Fixed retrieving the content type for Python 2.4.
This commit is contained in:
parent
37aa31c9f9
commit
20da952052
|
@ -485,10 +485,10 @@ class HTMLPage(object):
|
|||
req = Urllib2HeadRequest(url, headers={'Host': netloc})
|
||||
resp = urlopen(req)
|
||||
try:
|
||||
if resp.code != 200 and scheme not in ('ftp', 'ftps'):
|
||||
if hasattr(resp, 'code') and resp.code != 200 and scheme not in ('ftp', 'ftps'):
|
||||
## FIXME: doesn't handle redirects
|
||||
return ''
|
||||
return resp.info().getheader('Content-Type') or ''
|
||||
return resp.info().get('content-type', '')
|
||||
finally:
|
||||
resp.close()
|
||||
|
||||
|
|
Loading…
Reference in a new issue