Update for new gerrit API
The recent 2.11 -> 2.13 gerrit update had a hidden API chnage that broke our tools. Compare: * https://gerrit-documentation.storage.googleapis.com/Documentation/2.11.10/rest-api-accounts.html#suggest-account * https://gerrit-review.googlesource.com/Documentation/rest-api-accounts.html#query-account This change added the addition o=DETAILS and uses requests for parameter encoding Change-Id: I0a4670c58080ceb0d4c6993b3c57f6d4f96f3914
This commit is contained in:
parent
d080390617
commit
acdee44eb3
@ -66,8 +66,8 @@ def gerrit_datetime(dt):
|
||||
return dt.strftime('%Y-%m-%d %H:%M:%S %z')
|
||||
|
||||
|
||||
def gerrit_query(url):
|
||||
r = requests.get(url)
|
||||
def gerrit_query(url, params=None):
|
||||
r = requests.get(url, params=params)
|
||||
if r.status_code == 200:
|
||||
data = json.loads(r.text[4:])
|
||||
else:
|
||||
@ -87,8 +87,8 @@ def get_email(filepath):
|
||||
|
||||
|
||||
def get_gerrit_account(email):
|
||||
url = '%s/accounts/?q=%s' % (GERRIT_BASE, email)
|
||||
accounts = gerrit_query(url)
|
||||
accounts = gerrit_query('%s/accounts/' % (GERRIT_BASE),
|
||||
params={'q': email, 'o': ['DETAILS']})
|
||||
if not accounts:
|
||||
raise ValueError("Couldn't find gerrit account with '%s'" % email)
|
||||
if len(accounts) != 1:
|
||||
|
Loading…
Reference in New Issue
Block a user