mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2025-10-27 08:49:27 +00:00
Download cty.plist separately so errors can be better handled
This commit is contained in:
@@ -9,9 +9,6 @@ from core.constants import SOFTWARE_NAME, SOFTWARE_VERSION
|
||||
# Generic alert provider class. Subclasses of this query the individual APIs for alerts.
|
||||
class AlertProvider:
|
||||
|
||||
# HTTP headers used for spot providers that use HTTP
|
||||
HTTP_HEADERS = { "User-Agent": SOFTWARE_NAME + " " + SOFTWARE_VERSION + " (operated by " + SERVER_OWNER_CALLSIGN + ")" }
|
||||
|
||||
# Constructor
|
||||
def __init__(self, provider_config):
|
||||
self.name = provider_config["name"]
|
||||
|
||||
@@ -7,6 +7,7 @@ import pytz
|
||||
import requests
|
||||
|
||||
from alertproviders.alert_provider import AlertProvider
|
||||
from core.constants import HTTP_HEADERS
|
||||
|
||||
|
||||
# Generic alert provider class for providers that request data via HTTP(S). Just for convenience to avoid code
|
||||
@@ -35,7 +36,7 @@ class HTTPAlertProvider(AlertProvider):
|
||||
try:
|
||||
# Request data from API
|
||||
logging.debug("Polling " + self.name + " alert API...")
|
||||
http_response = requests.get(self.url, headers=self.HTTP_HEADERS)
|
||||
http_response = requests.get(self.url, headers=HTTP_HEADERS)
|
||||
# Pass off to the subclass for processing
|
||||
new_alerts = self.http_response_to_alerts(http_response)
|
||||
# Submit the new alerts for processing. There might not be any alerts for the less popular programs.
|
||||
|
||||
Reference in New Issue
Block a user