Commit 5919897c authored by Jason R. Coombs's avatar Jason R. Coombs

Use contextlib.closing for the response

parent d150f9d4
......@@ -344,7 +344,8 @@ def _resolve_version(version):
if version is not LATEST:
return version
with urlopen('https://pypi.python.org/pypi/setuptools/json') as resp:
resp = urlopen('https://pypi.python.org/pypi/setuptools/json')
with contextlib.closing(resp):
charset = resp.info().get_content_charset()
reader = codecs.getreader(charset)
doc = json.load(reader(resp))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment