Fix upload_video "string argument detected, got 'bytes'" bug.

Needed to use BytesIO instead of StringIO when uploading video to Twitter.

Tested with python 2.6.9, 2.7.11, 3.3.6, 3.5.1.

fixes #422
This commit is contained in:
Phil Gyford 2016-08-17 14:18:59 +01:00
parent 2faa84629b
commit 1b20f8f0f9

View file

@ -16,10 +16,11 @@ https://dev.twitter.com/docs/api/1.1
import os
import warnings
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
from io import BytesIO
#try:
#from StringIO import StringIO
#except ImportError:
#from io import StringIO
from .advisory import TwythonDeprecationWarning
@ -180,7 +181,7 @@ class EndpointsMixin(object):
data = media.read(1*1024*1024)
if not data:
break
media_chunk = StringIO()
media_chunk = BytesIO()
media_chunk.write(data)
media_chunk.seek(0)