Skip to content

Commit

Permalink
response.__bool__() returns False for Exception cases, so use "is not…
Browse files Browse the repository at this point in the history
… None" instead (#1748)

If conditions didn't match, because response.__bool__() uses response.ok, which returns False for every http status code >= 400, which is the case here, at least in Jira 9.4.11.
  • Loading branch information
brezelman authored Dec 21, 2023
1 parent f191690 commit 3df8344
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions jira/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1566,7 +1566,7 @@ def create_issues(
# Catching case where none of the issues has been created.
# See https://github.com/pycontribs/jira/issues/350
except JIRAError as je:
if je.status_code == 400 and je.response:
if je.status_code == 400 and je.response is not None:
raw_issue_json = json.loads(je.response.text)
else:
raise
Expand Down Expand Up @@ -4620,7 +4620,7 @@ def add_user(
try:
self._session.post(url, data=payload)
except JIRAError as e:
if e.response:
if e.response is not None:
err = e.response.json()["errors"]
if (
"username" in err
Expand Down

0 comments on commit 3df8344

Please sign in to comment.