mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Implement a default HTTP reason
This commit is contained in:
parent
5a1d5c21ff
commit
aad7f706d5
@ -39,6 +39,10 @@ class FakeResponse:
|
||||
self.final_url = res['final_url']
|
||||
self._status = res.get('http_code')
|
||||
self._reason = res.get('http_status_message')
|
||||
if not self._reason:
|
||||
from http.client import responses
|
||||
with suppress(KeyError):
|
||||
self._reason = responses[self._status]
|
||||
self._headers = res['headers']
|
||||
if 'error' in res:
|
||||
ex = URLError(res['error'])
|
||||
|
Loading…
x
Reference in New Issue
Block a user