diff --git a/zerver/lib/bugdown/__init__.py b/zerver/lib/bugdown/__init__.py index 10c4cec901..bdc8dd6f7c 100644 --- a/zerver/lib/bugdown/__init__.py +++ b/zerver/lib/bugdown/__init__.py @@ -82,6 +82,12 @@ def fetch_tweet_data(tweet_id): import testing_mocks res = testing_mocks.twitter(tweet_id) else: + if settings.TWITTER_CONSUMER_KEY == '' or \ + settings.TWITTER_CONSUMER_SECRET == '' or \ + settings.TWITTER_ACCESS_TOKEN_KEY == '' or \ + settings.TWITTER_ACCESS_TOKEN_SECRET == '': + return None + api = twitter.Api(consumer_key = settings.TWITTER_CONSUMER_KEY, consumer_secret = settings.TWITTER_CONSUMER_SECRET, access_token_key = settings.TWITTER_ACCESS_TOKEN_KEY,