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:
Leandro Toledo 2015-09-24 09:26:19 -03:00
commit 386accab80

View file

@ -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)