Skip to content

Commit

Permalink
Be kind; rewind
Browse files Browse the repository at this point in the history
Closes #26.
  • Loading branch information
tdsmith committed Jun 9, 2016
1 parent e00ebb6 commit e84c525
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions poet/poet.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import argparse
import codecs
from collections import OrderedDict
from contextlib import closing
from hashlib import sha256
import json
import logging
Expand Down Expand Up @@ -132,8 +133,8 @@ def research_package(name, version=None):
d['checksum'] = artefact['digests']['sha256']
else:
logging.debug("Fetching sdist to compute checksum for %s", name)
f = urlopen(artefact['url'])
d['checksum'] = sha256(f.read()).hexdigest()
with closing(urlopen(artefact['url'])) as f:
d['checksum'] = sha256(f.read()).hexdigest()
logging.debug("Done fetching %s", name)
d['checksum_type'] = 'sha256'
f.close()
Expand Down

0 comments on commit e84c525

Please sign in to comment.