1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-21 17:52:14 +01:00

Merge pull request #1683 from dmach/save-session-cookie-on-failed-requests

Save session cookie even if a request fails
This commit is contained in:
Daniel Mach 2025-01-06 08:46:36 +01:00 committed by GitHub
commit d72f393f4d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -390,12 +390,13 @@ def http_request(method: str, url: str, headers=None, data=None, file=None):
data.seek(0)
response = pool.urlopen(method, urlopen_url, body=data, headers=headers, preload_content=False)
if response.status / 100 != 2:
raise urllib.error.HTTPError(url, response.status, response.reason, response.headers, response)
# we want to save a session cookie before an exception is raised on failed requests
for handler in auth_handlers:
handler.process_response(url, headers, response)
if response.status / 100 != 2:
raise urllib.error.HTTPError(url, response.status, response.reason, response.headers, response)
return response