aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xlinaro_gerrit.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/linaro_gerrit.py b/linaro_gerrit.py
index 87a1c73..91eed88 100755
--- a/linaro_gerrit.py
+++ b/linaro_gerrit.py
@@ -5,6 +5,8 @@ import logging
import requests
+from requests.auth import HTTPBasicAuth
+
logging.basicConfig()
logging.getLogger("requests").setLevel(logging.WARNING)
log = logging.getLogger("linaro_gerrit")
@@ -20,14 +22,10 @@ class LinaroGerrit:
self.verify = not noverify
self.dryrun = dryrun
log.setLevel(getattr(logging, loglevel.upper()))
- try:
- from requests.auth import HTTPDigestAuth
- self.reqargs = {"auth": HTTPDigestAuth(username, password),
- "verify": self.verify}
- except ImportError:
- log.info("Using old version of python-requests \
- (--noverify not supported")
- self.reqargs = {"auth": ('digest', username, password)}
+ self.reqargs = {
+ "auth": HTTPBasicAuth(username, password),
+ "verify": self.verify
+ }
def strip_gerrit_junk(self, string):
# https://gerrit-review.googlesource.com/Documentation/rest-api.html#output
@@ -174,7 +172,7 @@ class LinaroGerrit:
if r.status_code == 200:
return json.loads(self.strip_gerrit_junk(r.content))
else:
- log.error("Failed to list projects")
+ log.error("Failed to list projects %s", r.status_code)
return {}
def set_project_parent(self, project, parent, commit_msg=""):