2013-04-09 15 views
5

私はtweepyを使ってtwitterアプリケーションを作成しています。 ユーザーがtweet/update profileなどを入力すると、エラーが発生します。私はエラーを分類し、ユーザーにもっと情報を与えたいと思っています。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 

はエラーを分類する唯一の方法は、例えば、文字列でAccount update failed: Description is too long (maximum is 160 characters)eを比較することがありますか?

答えて

1

これは唯一の方法です。 TweepError例外が1つだけ定義されています。それは異なるテキストでアプリ全体に提起されます。

ギフトボックスにはissueが公開されています。だから将来的に改善される可能性があります。

関連する問題