fix answer* methods not sending api requests

This commit is contained in:
Jeff 2017-05-22 22:55:19 +08:00
parent 1142953108
commit 43f4128b31

View file

@ -1927,6 +1927,7 @@ class Bot(TelegramObject):
ok,
shipping_options=None,
error_message=None,
timeout=None,
**kwargs):
"""
If you sent an invoice requesting a shipping address and the parameter is_flexible was
@ -1964,7 +1965,7 @@ class Bot(TelegramObject):
'answerShippingQuery: If ok is False, error_message '
'should not be empty and there should not be shipping_options')
url = '{0}/answerShippingQuery'.format(self.base_url)
url_ = '{0}/answerShippingQuery'.format(self.base_url)
data = {'shipping_query_id': shipping_query_id, 'ok': ok}
@ -1973,10 +1974,12 @@ class Bot(TelegramObject):
if error_message:
data['error_message'] = error_message
return url, data
result = self._request.post(url_, data, timeout=timeout)
return result
def answer_pre_checkout_query(self, pre_checkout_query_id, ok,
error_message=None, **kwargs):
error_message=None, timeout=None, **kwargs):
"""
If you sent an invoice requesting a shipping address and the parameter is_flexible was
specified, the Bot API will send an Update with a shipping_query field to the bot.
@ -2007,14 +2010,16 @@ class Bot(TelegramObject):
'not be error_message; if ok is False, error_message '
'should not be empty')
url = '{0}/answerPreCheckoutQuery'.format(self.base_url)
url_ = '{0}/answerPreCheckoutQuery'.format(self.base_url)
data = {'pre_checkout_query_id': pre_checkout_query_id, 'ok': ok}
if error_message:
data['error_message'] = error_message
return url, data
result = self._request.post(url_, data, timeout=timeout)
return result
@staticmethod
def de_json(data, bot):