Skip to content

Commit 5c6d233

Browse files
committed
Fixes unicode erros when sending files
1 parent 7924ba1 commit 5c6d233

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

telegram/bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ def getUpdates(self,
554554
json_data = self._requestUrl(url, 'POST', data=data)
555555
data = self._parseAndCheckTelegram(json_data)
556556

557-
return [Update.de_json(x) for x in data] # TODO: error handling
557+
return [Update.de_json(x) for x in data]
558558

559559
def setWebhook(self, webhook_url=""):
560560
"""Use this method to specify a url and receive incoming updates via an

telegram/inputfile.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,17 @@ def to_form(self):
4747
for name, value in self.data.iteritems():
4848
form.extend([
4949
form_boundary,
50-
'Content-Disposition: form-data; name="%s"' % name,
50+
str('Content-Disposition: form-data; name="%s"' % name),
5151
'',
5252
str(value)
5353
])
5454

5555
# Add input_file to upload
5656
form.extend([
5757
form_boundary,
58-
'Content-Disposition: form-data; name="%s"; filename="%s"' % (
58+
str('Content-Disposition: form-data; name="%s"; filename="%s"' % (
5959
self.input_name, self.filename
60-
),
60+
)),
6161
'Content-Type: %s' % self.mimetype,
6262
'',
6363
self.input_file_content

tests/test_bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def testGetUpdates(self):
3333
'''Test the telegram.Bot getUpdates method'''
3434
print 'Testing getUpdates'
3535
updates = self._bot.getUpdates()
36-
self.assertEqual(129566572, updates[0].update_id)
36+
self.assertEqual(129566577, updates[0].update_id)
3737

3838
def testForwardMessage(self):
3939
'''Test the telegram.Bot forwardMessage method'''

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy