From 4299f9a864bebad2934c382746633bba3dca847f Mon Sep 17 00:00:00 2001 From: Katsunori SUZUI Date: Fri, 13 Jun 2014 18:00:02 +0900 Subject: [PATCH] Fix tweepy.API.update_with_media If filename is an instance of `unicode', L.76 `` 'Content-Disposition: form-data; name="%s"; filename="%s"' % (form_field, filename) '' must be unicode string. Because of it, L. 803 `` body = '\r\n'.join(body) '' fails. Therefore, I made `filename' designed to be percent-encoded str object before formatting. --- tweepy/api.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tweepy/api.py b/tweepy/api.py index 81c3a95..90946a3 100644 --- a/tweepy/api.py +++ b/tweepy/api.py @@ -1231,10 +1231,9 @@ class API(object): raise TweepError('Invalid file type for image: %s' % file_type) if isinstance(filename, unicode): - filename = filename.encode("utf-8") + filename = filename.encode("utf-8") filename = urllib.quote(filename) - BOUNDARY = 'Tw3ePy' body = [] body.append('--' + BOUNDARY) -- 2.25.1