我一直在尝试使用Twython将mp4视频上传到Twitter。 但是" Upload_video" API返回400错误请求错误。
以下是我的代码和错误消息。
moviefile='/xxx/xxxx/xxx/xxx/xx.mp4' video=open(moviefile, 'rb') response=`api.upload_video(media=video, media_type='video/mp4')` api.update_status(status='Hello!!!',media_ids[response['media_id']]
File "movie_end.py", line 72, in tweet(moviefile) File "movie_end.py", line 26, in tweet response = api.upload_video(media=video, media_type='video/mp4') File "/usr/local/lib/python2.7/dist-packages/twython/endpoints.py", line 201, in upload_video return self.post(upload_url, params=params) File "/usr/local/lib/python2.7/dist-packages/twython/api.py", line 268, in post return self.request(endpoint, 'POST', params=params, version=version) File "/usr/local/lib/python2.7/dist-packages/twython/api.py", line 258, in request api_call=url) File "/usr/local/lib/python2.7/dist-packages/twython/api.py", line 194, in _request retry_after=response.headers.get('X-Rate-Limit-Reset')) twython.exceptions.TwythonError: Twitter API returned a 400 (Bad Request), An error occurred processing your request.
有没有人成功上传视频? 关于upload_video api几乎没有。 我使用下面的网页作为参考 https://twython.readthedocs.io/en/latest/usage/advanced_usage.html
你在我的剧本中发现任何错误吗?
顺便说一句,,,