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:
commit
d72f393f4d
@ -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
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user