Python tweepy/TwitterAPI错误类型

Python tweepy/TwitterAPI错误类型,python,twitter,tweepy,Python,Twitter,Tweepy,我正在使用tweepy制作一个twitter应用程序。 当用户推特/更新个人资料等,他们会得到一些错误。我想对错误进行分类,并向用户提供更多信息 try: tweet/update profile/ follow.... except tweepy.TweepError, e: if tweepy.TweepError is "Account update failed: Description is too long (maximum is 160 characters)"

我正在使用tweepy制作一个twitter应用程序。 当用户推特/更新个人资料等,他们会得到一些错误。我想对错误进行分类,并向用户提供更多信息

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
与字符串进行比较,例如,
帐户更新失败:说明太长(最多160个字符)

对,这是现在唯一的方法。只定义了一个异常。它通过不同的文本在整个应用程序中引发

下面是github上的相关开放式应用程序。因此,它有可能在未来得到改进