Move twitter API credentials to local_settings.py.

(imported from commit 6b95db113b91816fbc5e91db4b1be90d3df8e028)
This commit is contained in:
Tim Abbott 2013-09-24 14:38:12 -04:00
parent fff4244b54
commit 8a5fffa7cf
2 changed files with 27 additions and 20 deletions

View File

@ -82,26 +82,11 @@ def fetch_tweet_data(tweet_id):
import testing_mocks
res = testing_mocks.twitter(tweet_id)
else:
if settings.STAGING_DEPLOYED or settings.TESTING_DEPLOYED:
# Application: "Humbug HQ"
api = twitter.Api(consumer_key = 'xxxxxxxxxxxxxxxxxxxxxx',
consumer_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
access_token_key = 'xxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
access_token_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
elif settings.DEPLOYED:
# This is the real set of API credentials used by our real server,
# and we probably shouldn't test with it just so we don't waste its requests
# Application: "Humbug HQ - Production"
api = twitter.Api(consumer_key = 'xxxxxxxxxxxxxxxxxxxxx',
consumer_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
access_token_key = 'xxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
access_token_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
else:
# Application: "Humbug HQ Test"
api = twitter.Api(consumer_key = 'xxxxxxxxxxxxxxxxxxxxxx',
consumer_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
access_token_key = 'xxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
access_token_secret = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')
api = twitter.Api(consumer_key = settings.TWITTER_CONSUMER_KEY,
consumer_secret = settings.TWITTER_CONSUMER_SECRET,
access_token_key = settings.TWITTER_ACCESS_TOKEN_KEY,
access_token_secret = settings.TWITTER_ACCESS_TOKEN_SECRET)
try:
# Sometimes Twitter hangs on responses. Timing out here
# will cause the Tweet to go through as-is with no inline

View File

@ -59,3 +59,25 @@ else:
S3_AVATAR_BUCKET="humbug-user-avatars-test"
MIXPANEL_TOKEN="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
# Twitter API credentials
if STAGING_DEPLOYED or TESTING_DEPLOYED:
# Application: "Humbug HQ"
TWITTER_CONSUMER_KEY = "xxxxxxxxxxxxxxxxxxxxxx"
TWITTER_CONSUMER_SECRET = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
TWITTER_ACCESS_TOKEN_KEY = "xxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
TWITTER_ACCESS_TOKEN_SECRET = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
elif DEPLOYED:
# This is the real set of API credentials used by our real server,
# and we probably shouldn't test with it just so we don't waste its requests
# Application: "Humbug HQ - Production"
TWITTER_CONSUMER_KEY = "xxxxxxxxxxxxxxxxxxxxx"
TWITTER_CONSUMER_SECRET = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
TWITTER_ACCESS_TOKEN_KEY = "xxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
TWITTER_ACCESS_TOKEN_SECRET = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
else:
# Application: "Humbug HQ Test"
TWITTER_CONSUMER_KEY = "xxxxxxxxxxxxxxxxxxxxxx"
TWITTER_CONSUMER_SECRET = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
TWITTER_ACCESS_TOKEN_KEY = "xxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
TWITTER_ACCESS_TOKEN_SECRET = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"