Fixes unicode erros when sending files

This commit is contained in:
Leandro Toledo 2015-07-10 16:50:33 -03:00
parent 7924ba1bdb
commit 5c6d233179
3 changed files with 5 additions and 5 deletions

View file

@ -554,7 +554,7 @@ class Bot(object):
json_data = self._requestUrl(url, 'POST', data=data)
data = self._parseAndCheckTelegram(json_data)
return [Update.de_json(x) for x in data] # TODO: error handling
return [Update.de_json(x) for x in data]
def setWebhook(self, webhook_url=""):
"""Use this method to specify a url and receive incoming updates via an

View file

@ -47,7 +47,7 @@ class InputFile(object):
for name, value in self.data.iteritems():
form.extend([
form_boundary,
'Content-Disposition: form-data; name="%s"' % name,
str('Content-Disposition: form-data; name="%s"' % name),
'',
str(value)
])
@ -55,9 +55,9 @@ class InputFile(object):
# Add input_file to upload
form.extend([
form_boundary,
'Content-Disposition: form-data; name="%s"; filename="%s"' % (
str('Content-Disposition: form-data; name="%s"; filename="%s"' % (
self.input_name, self.filename
),
)),
'Content-Type: %s' % self.mimetype,
'',
self.input_file_content

View file

@ -33,7 +33,7 @@ class BotTest(unittest.TestCase):
'''Test the telegram.Bot getUpdates method'''
print 'Testing getUpdates'
updates = self._bot.getUpdates()
self.assertEqual(129566572, updates[0].update_id)
self.assertEqual(129566577, updates[0].update_id)
def testForwardMessage(self):
'''Test the telegram.Bot forwardMessage method'''