mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-12-22 22:45:09 +01:00
Merge pull request #74 from leandrotoledo/http_bad_gateway_as_except
Handles HTTP Bad Gateway error (503) on request module #63
This commit is contained in:
commit
386accab80
1 changed files with 2 additions and 0 deletions
|
@ -94,6 +94,8 @@ def post(url,
|
||||||
except HTTPError as error:
|
except HTTPError as error:
|
||||||
if error.getcode() == 403:
|
if error.getcode() == 403:
|
||||||
raise TelegramError('Unauthorized')
|
raise TelegramError('Unauthorized')
|
||||||
|
if error.getcode() == 502:
|
||||||
|
raise TelegramError('Bad Gateway')
|
||||||
|
|
||||||
message = _parse(error.read())
|
message = _parse(error.read())
|
||||||
raise TelegramError(message)
|
raise TelegramError(message)
|
||||||
|
|
Loading…
Reference in a new issue