diff options
author | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2014-12-03 16:48:55 +0000 |
---|---|---|
committer | Richard Ipsum <richard.ipsum@codethink.co.uk> | 2014-12-03 16:48:55 +0000 |
commit | 5417f67318a29d4d8b876497603dff36fe92763f (patch) | |
tree | af2becdcb8f180d53f1d4b7260b6b1673a37456a /exts/pip.to_lorry | |
parent | d411d2bd2a4c9fe5251d60ee10b865b958b30864 (diff) | |
download | import-5417f67318a29d4d8b876497603dff36fe92763f.tar.gz |
Give better err msg when we can't obtain metadata
Diffstat (limited to 'exts/pip.to_lorry')
-rwxr-xr-x | exts/pip.to_lorry | 9 |
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) |