devtools: if there's a message in the API call, print and exit

If you've got bad credentials, you'll get an error message.
This commit is contained in:
niftynei
2022-08-01 17:10:45 -05:00
committed by neil saitug
parent dfa325dc4d
commit 75ccce7808

View File

@@ -66,6 +66,10 @@ def get_log_entries(commitrange):
url = 'https://api.github.com/repos/{repo}/commits/{commit}/pulls'.format(repo=repo, commit=commit)
content = requests.get(url, headers=headers).json()
if len(content):
# Check for bad credentials
if 'message' in content:
print(content)
exit()
pullreq = content[0]['number']
else:
pullreq = None