File tree Expand file tree Collapse file tree 2 files changed +16
-13
lines changed Expand file tree Collapse file tree 2 files changed +16
-13
lines changed Original file line number Diff line number Diff line change 1
- import tomllib
2
-
1
+ from config import API_TOKEN , API_KEY , API_URL
3
2
import requests
4
3
5
- try :
6
- with open ("conf/config.toml" , "rb" ) as f :
7
- config = tomllib .load (f )
8
- except FileNotFoundError :
9
- print ("No config found! Please setup your config.toml from the template!" )
10
- exit (1 )
11
-
12
- API_KEY = config ["API-CONFIG" ]["api_key" ]
13
- API_TOKEN = config ["API-CONFIG" ]["api_token" ]
14
- API_URL = config ["API-CONFIG" ]["api_base_url" ]
15
-
16
4
# Set your authentication credentials (API key or bearer token)
17
5
HEADERS = {
18
6
"accept" : "application/json;charset=UTF-8" ,
Original file line number Diff line number Diff line change
1
+ import tomllib
2
+
3
+ try :
4
+ with open ("conf/config.toml" , "rb" ) as f :
5
+ config = tomllib .load (f )
6
+ config_exists = True
7
+ except FileNotFoundError :
8
+ print ("No config found! Please setup your config.toml from the template!" )
9
+ # ToDo: Here we could then ask if the user wants to put in the information and we write it to a config file
10
+ # Or if the user wants to supply the file themselves
11
+ exit (1 )
12
+
13
+ API_KEY = config ["API-CONFIG" ]["api_key" ]
14
+ API_TOKEN = config ["API-CONFIG" ]["api_token" ]
15
+ API_URL = config ["API-CONFIG" ]["api_base_url" ]
You can’t perform that action at this time.
0 commit comments