tweepy error response status code 400

倖福魔咒の 提交于 2020-01-14 09:24:06

问题


I'm trying to write a simple twitter bot using python and tweepy. The code is as follows:

import tweepy
CONSUMER_KEY = 'xxxxxxxxxxxxxxxxx'
CONSUMER_SECRET = 'xxxxxxxxxxxxxxxxxxxxx'
ACCESS_KEY = 'xxxxxxxxxxxxxxxxxxxxx'
ACCESS_SECRET = 'xxxxxxxxxxxxxxxxx'

auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)
api = tweepy.API(auth)

api.update_status('hi')

I get the following error:

TweepError: Twitter error response: status code = 400

I would like some info on how to avoid this error


回答1:


This may be a bug that emerged in the 3.2.0 release of Tweepy. See this issue opened on GitHub. In that issue, TylerGlaiel notes that api.update_status fails if called thus:

api.update_status('Test')

But works if called like so:

api.update_status(status='Test')

I have also found this works. I imagine a fix will be out before long.



来源:https://stackoverflow.com/questions/28124318/tweepy-error-response-status-code-400

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!