From e513b75e86e6c0db54e1d50ad538f705ac212add Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 23 Oct 2020 01:22:15 -0700 Subject: [PATCH] markdown: Remove handler for old bug with incompatible twitter library. See commit 8b002040e00bbe8a5bc6928010ddefb2df077b9d and #86. The development environment bug that necessitated this handler has long been irrelevant. Signed-off-by: Anders Kaseorg --- zerver/lib/markdown/__init__.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/zerver/lib/markdown/__init__.py b/zerver/lib/markdown/__init__.py index cef6c885cf..6b8d010cd0 100644 --- a/zerver/lib/markdown/__init__.py +++ b/zerver/lib/markdown/__init__.py @@ -388,8 +388,9 @@ def fetch_tweet_data(tweet_id: str) -> Optional[Dict[str, Any]]: # the startup performance of `manage.py` commands. import twitter + api = twitter.Api(tweet_mode='extended', **creds) + try: - api = twitter.Api(tweet_mode='extended', **creds) # Sometimes Twitter hangs on responses. Timing out here # will cause the Tweet to go through as-is with no inline # preview, rather than having the message be rejected @@ -397,10 +398,6 @@ def fetch_tweet_data(tweet_id: str) -> Optional[Dict[str, Any]]: # formatting timeout. tweet = timeout(3, api.GetStatus, tweet_id) res = tweet.AsDict() - except AttributeError: - markdown_logger.error('Unable to load twitter api, you may have the wrong ' - 'library installed, see https://github.com/zulip/zulip/issues/86') - return None except TimeoutExpired: # We'd like to try again later and not cache the bad result, # so we need to re-raise the exception (just as though