-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
49 lines (35 loc) · 1.29 KB
/
settings.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
38
39
40
41
42
43
44
45
46
47
48
49
# Changing this file updates the settings for this entire project
# to test this you can run 'python3 settings.py'
import os
import sys
import shlex
try:
import yaml
except ImportError:
print(
"Could not import yaml. Fix this by running: 'python3 -m pip install PyYAML'",
file=sys.stderr,
)
sys.exit(1)
this_dir = os.path.abspath(os.path.dirname(__file__))
BASE_SPREADSHEETS_CSV_FILE = os.path.join(this_dir, "spreadsheet.csv")
SPREADSHEET_ID = "12htSAMg67czl8cpkj1mX0TuAFvqL_PJLI4hv1arG5-M"
DISCOGS_CREDS = {}
discogs_data_file = os.path.join(this_dir, "discogs_token.yaml")
if os.path.exists(discogs_data_file):
with open(discogs_data_file, "r") as f:
DISCOGS_CREDS = yaml.load(f, Loader=yaml.FullLoader)
CLIENT_SECRET_FILE = os.path.join(this_dir, "client_secret.json")
CREDENTIALS_DIR = os.path.join(os.path.expanduser("~"), ".credentials")
os.makedirs(CREDENTIALS_DIR, exist_ok=True)
CREDENTIALS_PATH = os.path.join(
CREDENTIALS_DIR, "sheets.googleapis.com-python-nextalbums.json"
)
CSV_DATADIR = os.path.join(this_dir, "csv_data")
assert os.path.exists(CSV_DATADIR)
def print_options():
for name, obj in globals().items():
if name.isupper():
print(f"{name}={shlex.quote(str(obj))}")
if __name__ == "__main__":
print_options()