summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Ipsum <richard.ipsum@codethink.co.uk>2014-12-04 18:45:23 +0000
committerRichard Ipsum <richard.ipsum@codethink.co.uk>2014-12-04 18:45:23 +0000
commite69115ff3bf050dccb442e395022ff1494ba4e22 (patch)
tree7f94587ef6c0f60be63b5b15df3d5ddd895a9065
parentfbbdbb245150064e952cad317c9156911855daf9 (diff)
downloadimport-e69115ff3bf050dccb442e395022ff1494ba4e22.tar.gz
Don't attempt repo detection unless we get 200 OK
-rwxr-xr-xexts/pip.to_lorry11
1 files changed, 11 insertions, 0 deletions
diff --git a/exts/pip.to_lorry b/exts/pip.to_lorry
index 335d40a..b3a89ac 100755
--- a/exts/pip.to_lorry
+++ b/exts/pip.to_lorry
@@ -45,6 +45,17 @@ def fetch_package_metadata(package_name):
return result.json()
def find_repo_type(url):
+
+ # Don't bother with detection if we can't get a 200 OK
+ logging.debug("Getting '%s' ..." % url)
+
+ status_code = requests.get(url).status_code
+ if status_code != 200:
+ logging.debug('Got %d status code from %s, aborting repo detection'
+ % (status_code, url))
+ return None
+
+ logging.debug('200 OK for %s' % url)
logging.debug('Finding repo type for %s' % url)
vcss = [('git', 'clone'), ('hg', 'clone'),