|
if resp.status in (401, 403): |
|
raise Unauthorized(message) |
|
elif resp.status == 400: |
|
raise BadRequest(message) |
|
elif resp.status == 404: |
|
raise InvalidToken() |
|
elif resp.status == 409: |
|
raise Conflict(message) |
|
elif resp.status == 413: |
|
raise NetworkError( |
|
'File too large. Check telegram api limits ' |
|
'https://core.telegram.org/bots/api#senddocument' |
|
) |
We currently raise InvalidToken for 404, though 404 seems to be raised when requesting non-existing methods.
Unauthorized (=401) is the acutal InvalidToken and 403 gives Forbidden. So
- 401 ->
Unauthorized
- 403 ->
Forbidden
- drop
InvalidToken/only use it in Bot._validate_token
I do think we should update that. However those are pretty much breaking changes, so probably only in the next major release …
python-telegram-bot/telegram/utils/request.py
Lines 268 to 280 in ff3fd34
We currently raise
InvalidTokenfor 404, though 404 seems to be raised when requesting non-existing methods.Unauthorized(=401) is the acutalInvalidTokenand 403 givesForbidden. SoUnauthorizedForbiddenInvalidToken/only use it inBot._validate_tokenI do think we should update that. However those are pretty much breaking changes, so probably only in the next major release …