tweepy/twitter api错误类型
问题描述:
我使用tweepy来制作twitter应用程序。 当用户推特/更新配置文件等,他们会得到一些错误。我想分类错误并为用户提供更多信息。tweepy/twitter api错误类型
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
是分类错误的唯一方法是比较e
与字符串,例如,Account update failed: Description is too long (maximum is 160 characters)
?