-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.py
More file actions
24 lines (19 loc) · 764 Bytes
/
config.py
File metadata and controls
24 lines (19 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os
from pathlib import Path
from dotenv import load_dotenv
class Config:
event = "europython-2025"
event_dir_name = "ep2025"
api_version = "v1"
project_root = Path(__file__).resolve().parents[1]
raw_path = Path(f"{project_root}/data/raw/{event_dir_name}")
public_path = Path(f"{project_root}/data/public/{event_dir_name}")
@classmethod
def token(cls) -> str:
dotenv_exists = load_dotenv(cls.project_root / ".env")
if (token := os.getenv("PRETALX_TOKEN")) and not dotenv_exists:
print("Please prefer .env file to store your token! It's more secure!")
return token
elif token is None:
raise ValueError("Please set your token in .env file!")
return token