summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2014-12-03 16:48:55 +0000
committerRichard Ipsum <richard.ipsum@codethink.co.uk>2014-12-03 16:48:55 +0000
commit5417f67318a29d4d8b876497603dff36fe92763f (patch)
treeaf2becdcb8f180d53f1d4b7260b6b1673a37456a
parentd411d2bd2a4c9fe5251d60ee10b865b958b30864 (diff)
downloadimport-5417f67318a29d4d8b876497603dff36fe92763f.tar.gz
Give better err msg when we can't obtain metadata
-rwxr-xr-xexts/pip.to_lorry9
1 files changed, 7 insertions, 2 deletions
diff --git a/exts/pip.to_lorry b/exts/pip.to_lorry
index 205d4e3..de03271 100755
--- a/exts/pip.to_lorry
+++ b/exts/pip.to_lorry
@@ -35,9 +35,14 @@ from importer_pip_common import *
def fetch_package_metadata(package_name):
try:
- return requests.get('%s/%s/json' % (PYPI_URL, package_name)).json()
+ result = requests.get('%s/%s/json' % (PYPI_URL, package_name))
+
+ # raise exception if status code is not 200 OK
+ result.raise_for_status()
except Exception as e:
- error("Couldn't fetch package metadata: ", e)
+ error("Couldn't fetch package metadata:", e)
+
+ return result.json()
def find_repo_type(url):
logging.debug('Finding repo type for %s' % url)