Joh*_*ohn 5 python twitter tweepy
我正在使用tweepy制作推特应用程序.当用户发推文/更新个人资料等时,他们会收到一些错误.我想对错误进行分类并为用户提供更多信息.
try:
tweet/update profile/ follow....
except tweepy.TweepError, e:
if tweepy.TweepError is "Account update failed: Description is too long (maximum is 160 characters)"
Do something
if tweepy.TweepError is "Failed to send request: Invalid request URL: http://api.twitter.com/1/account/update_profile.json?location=%E5%85%B5%E5%BA%A"
Do something
if tweepy.TweepError is "[{u'message': u'Over capacity', u'code': 130}]"
Do something
Run Code Online (Sandbox Code Playgroud)
分类错误的唯一方法是e与字符串进行比较,例如,Account update failed: Description is too long (maximum is 160 characters)?
| 归档时间: |
|
| 查看次数: |
2282 次 |
| 最近记录: |