I'm trying to post a video on behalf of someone through Twython
.
I have followed the Twython video upload docs to achieve it, but it fails with an error on the upload_video()
method that their github page marked as solved (still happens to me though).
I tried an SO solution I've found, but it fails also with TypeError: post() got an unexpected keyword argument 'files'
.
So... Is there any way to achieve that using Twython?
My code:
from twython import Twython
twitter = Twython(...)
video = open(video_path, 'rb')
response = twitter.upload_video(media=video, media_type='video/mp4')
twitter.update_status(status='Checkout this cool video!', media_ids=[response['media_id']])
Result
.
.
response = twitter.upload_video(media=video, media_type='video/mp4')
File "/usr/local/lib/python3.5/dist-packages/twython/endpoints.py", line 184, in upload_video
media_chunk.write(data)
TypeError: string argument expected, got 'bytes'