test
This commit is contained in:
parent
dbe3441e65
commit
8492333842
@ -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():
|
||||||
|
|||||||
@ -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"]
|
||||||
|
|||||||
@ -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:
|
fhdhrweb.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:
|
||||||
|
|||||||
@ -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)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user