Skip to content

Commit

Permalink
Add certificate arg to setWebhook function
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrotoledo committed Sep 4, 2015
1 parent 910959b commit 05b7fda
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 78 deletions.
15 changes: 10 additions & 5 deletions telegram/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ def __init__(self,

def info(func):
"""
bla
Returns:
"""
@functools.wraps(func)
def decorator(self, *args, **kwargs):
"""
bla
decorator
"""
if not self.bot:
self.getMe()
Expand Down Expand Up @@ -660,7 +660,8 @@ def getUpdates(self,

@log
def setWebhook(self,
webhook_url):
webhook_url=None,
certificate=None):
"""Use this method to specify a url and receive incoming updates via an
outgoing webhook. Whenever there is an update for the bot, we will send
an HTTPS POST request to the specified url, containing a
Expand All @@ -677,12 +678,16 @@ def setWebhook(self,
"""
url = '%s/setWebhook' % self.base_url

data = {'url': webhook_url}
data = {}
if webhook_url:
data['url'] = webhook_url
if certificate:
data['certificate'] = certificate

json_data = self._requestUrl(url, 'POST', data=data)
data = self._parseAndCheckTelegram(json_data)

return True
return data

@staticmethod
def _requestUrl(url,
Expand Down
3 changes: 3 additions & 0 deletions telegram/inputfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ def __init__(self,
if 'voice' in data:
self.input_name = 'voice'
self.input_file = data.pop('voice')
if 'certificate' in data:
self.input_name = 'certificate'
self.input_file = data.pop('certificate')

if isinstance(self.input_file, file):
self.input_file_content = self.input_file.read()
Expand Down
73 changes: 0 additions & 73 deletions testscommand_handlertest.py

This file was deleted.

0 comments on commit 05b7fda

Please sign in to comment.