update path

Signed-off-by: Omar Sánchez Pizarro <omar.sanchez@pistacero.net>
This commit is contained in:
Omar Sánchez Pizarro
2025-10-10 00:29:55 +02:00
parent 7e5219ed72
commit 967f7e52a2
2 changed files with 7 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ import yaml
import telegram import telegram
import html import html
import telegram.ext import telegram.ext
import os
ITEM_HTML = """ ITEM_HTML = """
<b>Resultados para:</b> {search_name} <b>Resultados para:</b> {search_name}
@@ -37,7 +38,8 @@ class TelegramManager:
asyncio.set_event_loop(self._loop) asyncio.set_event_loop(self._loop)
def get_config(self): def get_config(self):
config_file = 'config.yaml' base_dir = os.path.dirname(os.path.abspath(__file__))
config_file = os.path.join(base_dir, 'config.yaml')
with open(config_file, 'r') as file: with open(config_file, 'r') as file:
config = yaml.safe_load(file) config = yaml.safe_load(file)
token = config['telegram_token'] token = config['telegram_token']

View File

@@ -25,7 +25,10 @@ def configure_logger():
handlers=[console_handler, file_handler]) handlers=[console_handler, file_handler])
def parse_items_to_monitor(): def parse_items_to_monitor():
with open("workers.json") as f: import os
base_dir = os.path.dirname(os.path.abspath(__file__))
workers_path = os.path.join(base_dir, "workers.json")
with open(workers_path) as f:
args = json.load(f) args = json.load(f)
if 'items' not in args: if 'items' not in args:
raise ValueError("Missing mandatory field: items") raise ValueError("Missing mandatory field: items")