Extract config into yaml

This commit is contained in:
Ian Renton
2025-09-27 14:54:14 +01:00
parent 6d735cfc67
commit 00c56a7c10
9 changed files with 48 additions and 14 deletions

View File

@@ -7,10 +7,11 @@ from time import sleep
import pytz
import telnetlib3
from core.constants import SERVER_OWNER_CALLSIGN
from data.spot import Spot
from core.config import config
from providers.provider import Provider
# Provider for a DX Cluster. Hostname and port provided as parameters.
class DXCluster(Provider):
CALLSIGN_PATTERN = "([a-z|0-9|/]+)"
@@ -49,7 +50,7 @@ class DXCluster(Provider):
logging.info("DX Cluster " + self.hostname + " connecting...")
self.telnet = telnetlib3.Telnet(self.hostname, self.port)
self.telnet.read_until("login: ".encode("utf-8"))
self.telnet.write((SERVER_OWNER_CALLSIGN + "\n").encode("utf-8"))
self.telnet.write((config["server-owner-callsign"] + "\n").encode("utf-8"))
connected = True
logging.info("DX Cluster " + self.hostname + " connected.")
except Exception as e:

View File

@@ -2,14 +2,15 @@ from datetime import datetime
import pytz
from core.constants import SOFTWARE_NAME, SOFTWARE_VERSION, SERVER_OWNER_CALLSIGN
from core.constants import SOFTWARE_NAME, SOFTWARE_VERSION
from core.config import config
# Generic data provider class. Subclasses of this query the individual APIs for data.
class Provider:
# HTTP headers used for providers that use HTTP
HTTP_HEADERS = { "User-Agent": SOFTWARE_NAME + " " + SOFTWARE_VERSION + " (operated by " + SERVER_OWNER_CALLSIGN + ")" }
HTTP_HEADERS = { "User-Agent": SOFTWARE_NAME + " " + SOFTWARE_VERSION + " (operated by " + config["server-owner-callsign"] + ")" }
# Constructor
def __init__(self):