Update config.py
Browse files
config.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
-
# config.py
|
2 |
import json
|
3 |
import os
|
4 |
import logging
|
5 |
from pathlib import Path
|
|
|
6 |
|
7 |
# Pfade
|
8 |
BASE_DIR = Path(__file__).parent
|
@@ -20,23 +21,30 @@ def setup_logging():
|
|
20 |
logging.StreamHandler()
|
21 |
]
|
22 |
)
|
|
|
23 |
|
24 |
# Dynamische Feed-Konfiguration
|
25 |
-
def load_feeds():
|
26 |
with open(FEEDS_FILE) as f:
|
27 |
return json.load(f)
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
|
|
|
|
|
|
33 |
|
34 |
# Einstellungen
|
35 |
SETTINGS = {
|
36 |
"check_interval": 5,
|
37 |
"max_retries": 3,
|
38 |
"request_timeout": 10,
|
39 |
-
"max_articles": 50
|
|
|
|
|
|
|
40 |
}
|
41 |
|
42 |
# Kategorien und Filter
|
|
|
1 |
+
# config.py
|
2 |
import json
|
3 |
import os
|
4 |
import logging
|
5 |
from pathlib import Path
|
6 |
+
from typing import Dict, List, Union
|
7 |
|
8 |
# Pfade
|
9 |
BASE_DIR = Path(__file__).parent
|
|
|
21 |
logging.StreamHandler()
|
22 |
]
|
23 |
)
|
24 |
+
logging.getLogger("apscheduler").setLevel(logging.WARNING)
|
25 |
|
26 |
# Dynamische Feed-Konfiguration
|
27 |
+
def load_feeds() -> List[Dict]:
|
28 |
with open(FEEDS_FILE) as f:
|
29 |
return json.load(f)
|
30 |
|
31 |
+
def load_api_keys() -> Dict[str, str]:
|
32 |
+
try:
|
33 |
+
with open(API_KEYS_FILE) as f:
|
34 |
+
return json.load(f)
|
35 |
+
except FileNotFoundError:
|
36 |
+
logging.warning("API-Keys-Datei nicht gefunden!")
|
37 |
+
return {}
|
38 |
|
39 |
# Einstellungen
|
40 |
SETTINGS = {
|
41 |
"check_interval": 5,
|
42 |
"max_retries": 3,
|
43 |
"request_timeout": 10,
|
44 |
+
"max_articles": 50,
|
45 |
+
"telegram_chat_id": "",
|
46 |
+
"telegram_bot_token": "",
|
47 |
+
"newsapi_page_size": 100
|
48 |
}
|
49 |
|
50 |
# Kategorien und Filter
|