Skip to content

Commit 692f97a

Browse files
authored
add unauthorized error handling (#1228)
* add unauthorized error handling * change unauthorized error handling via response headers * reformat if statement * update if statement
1 parent 8775e4c commit 692f97a

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

atlassian/confluence.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3140,6 +3140,9 @@ def raise_for_status(self, response):
31403140
:param response:
31413141
:return:
31423142
"""
3143+
if response.status_code == 401 and response.headers.get("Content-Type") != "application/json;charset=UTF-8":
3144+
raise HTTPError("Unauthorized (401)", response=response)
3145+
31433146
if 400 <= response.status_code < 600:
31443147
try:
31453148
j = response.json()

atlassian/rest_client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,9 @@ def raise_for_status(self, response):
467467
:param response:
468468
:return:
469469
"""
470+
if response.status_code == 401 and response.headers.get("Content-Type") != "application/json;charset=UTF-8":
471+
raise HTTPError("Unauthorized (401)", response=response)
472+
470473
if 400 <= response.status_code < 600:
471474
try:
472475
j = response.json()

0 commit comments

Comments
 (0)