Commit 4299f9a8 authored by Katsunori SUZUI's avatar Katsunori SUZUI Committed by Aaron Hill
Browse files

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.
parent e9310b36
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment