Compare commits

...

2 Commits

Author SHA1 Message Date
deathbybandaid
ee125daa0b test 2020-12-16 09:20:39 -05:00
deathbybandaid
8492333842 test 2020-12-16 09:15:25 -05:00
4 changed files with 24 additions and 9 deletions

View File

@ -19,7 +19,7 @@ class fHDHR_INT_OBJ():
self.web = fHDHR.tools.WebReq() self.web = fHDHR.tools.WebReq()
self.api = fHDHR_API_URLs(settings) self.api = fHDHR_API_URLs(settings, self.web)
class fHDHR_OBJ(): class fHDHR_OBJ():

View File

@ -1,10 +1,26 @@
import urllib.parse import urllib.parse
class Fillin_Client():
def __init__(self, settings, web):
self.config = settings
self.web = web
def __getattr__(self, name):
''' will only get called for undefined attributes '''
if hasattr(self.web.session, name):
return eval("self.web.session." + name)
class fHDHR_API_URLs(): class fHDHR_API_URLs():
def __init__(self, settings): def __init__(self, settings, web):
self.config = settings self.config = settings
self.web = web
# Replaced later
self.client = Fillin_Client(settings, web)
self.address = self.config.dict["fhdhr"]["address"] self.address = self.config.dict["fhdhr"]["address"]
self.discovery_address = self.config.dict["fhdhr"]["discovery_address"] self.discovery_address = self.config.dict["fhdhr"]["discovery_address"]

View File

@ -74,13 +74,7 @@ def run(settings, logger, db, script_dir, fHDHR_web, origin, alternative_epg):
# Hit EPG Update API URL without waiting # Hit EPG Update API URL without waiting
fhdhr.logger.info("Waiting 3 seconds to send startup tasks trigger.") fhdhr.logger.info("Waiting 3 seconds to send startup tasks trigger.")
time.sleep(3) time.sleep(3)
try: fhdhr.api.client.get("/api/startup_tasks")
fhdhr.web.session.get("%s/api/startup_tasks" % (fhdhr.api.base))
except fhdhr.web.exceptions.ReadTimeout:
pass
except fhdhr.web.exceptions.ConnectionError as e:
fhdhr.logger.warning("Startup tasks failed: %s" % e)
pass
# wait forever # wait forever
while True: while True:

View File

@ -134,3 +134,8 @@ class WebReq():
def __init__(self): def __init__(self):
self.session = requests.Session() self.session = requests.Session()
self.exceptions = requests.exceptions self.exceptions = requests.exceptions
def __getattr__(self, name):
''' will only get called for undefined attributes '''
if hasattr(self.session, name):
return eval("self.session." + name)