Skip to content

Commit b9eaa59

Browse files
committed
session: Fix API leak pt2
Between the time 182e0b0 was written, 138caf8 was committed which inadvertently loosened up the api_key scraping. Go back to catching `Exception` so we try harder to scrape api_key from error messages. Signed-off-by: Cole Robinson <[email protected]>
1 parent f95ff31 commit b9eaa59

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

bugzilla/_session.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,15 @@ def request(self, *args, **kwargs):
107107
response.encoding = "UTF-8"
108108

109109
response.raise_for_status()
110-
except requests.HTTPError as e:
110+
except Exception as e:
111111
# Scrape the api key out of the returned exception string
112112
message = str(e).replace(self._api_key or "", "")
113-
response = getattr(e, "response", None)
114-
raise BugzillaHTTPError(message, response=response).with_traceback(
115-
sys.exc_info()[2]
116-
)
113+
if isinstance(e, requests.HTTPError):
114+
response = getattr(e, "response", None)
115+
raise BugzillaHTTPError(
116+
message, response=response).with_traceback(
117+
sys.exc_info()[2])
118+
raise type(e)(message).with_traceback(sys.exc_info()[2])
119+
117120

118121
return response

0 commit comments

Comments
 (0)