mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2024-12-22 06:25:12 +01:00
Merge pull request #23 from wjt/requestUrl-error-path
Bot._requestUrl: raise if method not in ('GET', 'POST')
This commit is contained in:
commit
30fd5d79c3
1 changed files with 2 additions and 1 deletions
|
@ -587,6 +587,8 @@ class Bot(TelegramObject):
|
|||
Returns:
|
||||
A JSON object.
|
||||
"""
|
||||
if method not in ('POST', 'GET'):
|
||||
raise ValueError("Method '{}' is neither 'POST' nor 'GET'".format(method))
|
||||
|
||||
if method == 'POST':
|
||||
try:
|
||||
|
@ -618,7 +620,6 @@ class Bot(TelegramObject):
|
|||
except URLError as e:
|
||||
raise TelegramError(str(e))
|
||||
|
||||
return 0 # if not a POST or GET request
|
||||
|
||||
def _parseAndCheckTelegram(self,
|
||||
json_data):
|
||||
|
|
Loading…
Reference in a new issue