Elffuss BraidHub

kikocis/Based-Agent public

use tweepy exceptions, not errors
Changeset86b953e287d657e86df4875673e156b4114a477307461ba401f0539f4b617f42
AuthorMike Solomon <mike.solomon@coinbase.com> · 2024-10-26 17:17 -04:00
CommitterMike Solomon <mike.solomon@coinbase.com> · 2024-10-26 17:17 -04:00
Parents22053ccd09b7

Browse the files at this changeset

1 file changed

modified Based-Agent/twitter_utils.py +4 −4
@@ -22,7 +22,7 @@
2222 try:
2323 tweet = self.api.update_status(content)
2424 return f"Successfully posted tweet with ID: {tweet.id}"
25- except tweepy.TweepError as e:
25+ except tweepy.TweepException as e:
2626 return f"Error posting tweet: {str(e)}"
2727
2828 def read_mentions(self, count: int = 10) -> List[Dict]:
@@ -43,7 +43,7 @@
4343 'user': mention.user.screen_name,
4444 'created_at': mention.created_at
4545 } for mention in mentions]
46- except tweepy.TweepError as e:
46+ except tweepy.TweepException as e:
4747 return [{'error': str(e)}]
4848
4949 def reply_to_tweet(self, tweet_id: str, content: str) -> str:
@@ -68,7 +68,7 @@
6868 auto_populate_reply_metadata=True
6969 )
7070 return f"Successfully replied to tweet {tweet_id}"
71- except tweepy.TweepError as e:
71+ except tweepy.TweepException as e:
7272 return f"Error replying to tweet: {str(e)}"
7373
7474 def search_tweets(self, query: str, count: int = 10) -> List[Dict]:
@@ -90,5 +90,5 @@
9090 'user': tweet.user.screen_name,
9191 'created_at': tweet.created_at
9292 } for tweet in tweets]
93- except tweepy.TweepError as e:
93+ except tweepy.TweepException as e:
9494 return [{'error': str(e)}]
No newline at the end of the file