From: Katsunori SUZUI Date: Fri, 13 Jun 2014 09:00:02 +0000 (+0900) Subject: Fix tweepy.API.update_with_media X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=4299f9a864bebad2934c382746633bba3dca847f;p=tweepy.git 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. --- 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)