test
This commit is contained in:
parent
dbe3441e65
commit
8492333842
@ -19,7 +19,7 @@ class fHDHR_INT_OBJ():
|
||||
|
||||
self.web = fHDHR.tools.WebReq()
|
||||
|
||||
self.api = fHDHR_API_URLs(settings)
|
||||
self.api = fHDHR_API_URLs(settings, self.web)
|
||||
|
||||
|
||||
class fHDHR_OBJ():
|
||||
|
||||
@ -1,10 +1,26 @@
|
||||
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():
|
||||
|
||||
def __init__(self, settings):
|
||||
def __init__(self, settings, web):
|
||||
self.config = settings
|
||||
self.web = web
|
||||
|
||||
# Replaced later
|
||||
self.client = Fillin_Client(settings, web)
|
||||
|
||||
self.address = self.config.dict["fhdhr"]["address"]
|
||||
self.discovery_address = self.config.dict["fhdhr"]["discovery_address"]
|
||||
|
||||
@ -74,13 +74,7 @@ def run(settings, logger, db, script_dir, fHDHR_web, origin, alternative_epg):
|
||||
# Hit EPG Update API URL without waiting
|
||||
fhdhr.logger.info("Waiting 3 seconds to send startup tasks trigger.")
|
||||
time.sleep(3)
|
||||
try:
|
||||
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
|
||||
fhdhrweb.client.get("/api/startup_tasks")
|
||||
|
||||
# wait forever
|
||||
while True:
|
||||
|
||||
@ -134,3 +134,8 @@ class WebReq():
|
||||
def __init__(self):
|
||||
self.session = requests.Session()
|
||||
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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user