forked from BrianMitchL/weatherBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
keys.py
37 lines (29 loc) · 1.18 KB
/
keys.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""
weatherBot keys
Copyright 2015-2016 Brian Mitchell under the MIT license
See the GitHub repository: https://github.com/BrianMitchL/weatherBot
"""
import os
KEYS = {
'consumer_key': 'xxx',
'consumer_secret': 'xxx',
'access_token': 'xxx',
'access_token_secret': 'xxx',
'darksky_key': 'xxx'
}
def set_twitter_env_vars():
"""
If no Twitter environmental variables are set, set them based on the keys dict
"""
if os.getenv('WEATHERBOT_CONSUMER_KEY', 0) is 0 or os.getenv('WEATHERBOT_CONSUMER_SECRET', 0) is 0 \
or os.getenv('WEATHERBOT_ACCESS_TOKEN', 0) is 0 or os.getenv('WEATHERBOT_ACCESS_TOKEN_SECRET', 0) is 0:
os.environ['WEATHERBOT_CONSUMER_KEY'] = KEYS['consumer_key']
os.environ['WEATHERBOT_CONSUMER_SECRET'] = KEYS['consumer_secret']
os.environ['WEATHERBOT_ACCESS_TOKEN'] = KEYS['access_token']
os.environ['WEATHERBOT_ACCESS_TOKEN_SECRET'] = KEYS['access_token_secret']
def set_darksky_env_vars():
"""
If no Dark Sky environmental variable is set, set it based on the keys dict
"""
if os.getenv('WEATHERBOT_DARKSKY_KEY', 0) is 0:
os.environ['WEATHERBOT_DARKSKY_KEY'] = KEYS['darksky_key']