Only render tweets if we have credentials

(imported from commit 46c59f430aeae87a832f33d2ccb85209f9caec74)
This commit is contained in:
Leo Franchi 2013-10-10 15:30:35 -04:00
parent 1b381b343d
commit a2a1867f25
1 changed files with 6 additions and 0 deletions

View File

@ -82,6 +82,12 @@ def fetch_tweet_data(tweet_id):
import testing_mocks import testing_mocks
res = testing_mocks.twitter(tweet_id) res = testing_mocks.twitter(tweet_id)
else: 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, api = twitter.Api(consumer_key = settings.TWITTER_CONSUMER_KEY,
consumer_secret = settings.TWITTER_CONSUMER_SECRET, consumer_secret = settings.TWITTER_CONSUMER_SECRET,
access_token_key = settings.TWITTER_ACCESS_TOKEN_KEY, access_token_key = settings.TWITTER_ACCESS_TOKEN_KEY,