Merge pull request #23 from wjt/requestUrl-error-path

Bot._requestUrl: raise if method not in ('GET', 'POST')
This commit is contained in:
Leandro Toledo 2015-07-31 13:44:43 -03:00
commit 30fd5d79c3

View file

@ -587,6 +587,8 @@ class Bot(TelegramObject):
Returns: Returns:
A JSON object. A JSON object.
""" """
if method not in ('POST', 'GET'):
raise ValueError("Method '{}' is neither 'POST' nor 'GET'".format(method))
if method == 'POST': if method == 'POST':
try: try:
@ -618,7 +620,6 @@ class Bot(TelegramObject):
except URLError as e: except URLError as e:
raise TelegramError(str(e)) raise TelegramError(str(e))
return 0 # if not a POST or GET request
def _parseAndCheckTelegram(self, def _parseAndCheckTelegram(self,
json_data): json_data):