aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Copeland <ben.copeland@linaro.org>2017-06-27 09:42:18 +0100
committerBen Copeland <ben.copeland@linaro.org>2017-06-27 09:42:18 +0100
commit15b50003095206191659588739170e7b6d95f0e4 (patch)
tree25c0dc3f3d1f26ab8f9ed480295e3f63a82c5934
parent8effd26076bce45b65bc176646cfd52cf2a13ef6 (diff)
downloadlinaro-git-tools-15b50003095206191659588739170e7b6d95f0e4.tar.gz
linaro_gerrit: Remove digest support
In Gerrit 2.14, HTTP Digest has been removed, move to HTTPBasicAuth instead Change-Id: Idf3f9800f068b9ca7ca370a0cfd6c3e00f8993ee
-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=""):