-
Notifications
You must be signed in to change notification settings - Fork 0
/
load_passwords.py
31 lines (25 loc) · 1.11 KB
/
load_passwords.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
import os.path
import runpy
import sys
example = """#--------------------------------------------------------------------------------
# These tokens are needed for user authentication.
# Credentials can be generates via Twitter's Application Management:
# https://apps.twitter.com/app/new
#--------------------------------------------------------------------------------
consumer_key = "XxXxXxxXXXxxxxXXXxXX"
consumer_secret = "XxXxXxxXXXxxxxXXXxXX"
access_token_key = "XxXxXxxXXXxxxxXXXxXX-XxXxXxxXXXxxxxXXXxXX"
access_token_secret = "XxXxXxxXXXxxxxXXXxXX"
"""
passwordPath = "./passwords.py"
def load():
if os.path.isfile(passwordPath):
config = runpy.run_path(passwordPath)
if config["consumer_key"] == "XxXxXxxXXXxxxxXXXxXX":
print("You will need to create a twitter app and fill in the values in passwords.py. Exiting...")
sys.exit()
return config
with open(passwordPath, 'w') as passwords:
passwords.write(example)
print("Created passwords.py. You will need to create a twitter app and fill in the values in passwords.py. Exiting...")
sys.exit()