initializes the session before attempting to use it
This commit is contained in:
4
app.py
4
app.py
@ -47,13 +47,13 @@ def send_webhook(device, status, diagnostics):
|
|||||||
class UnifiAPI:
|
class UnifiAPI:
|
||||||
def __init__(self, config):
|
def __init__(self, config):
|
||||||
self.base_url = config['unifi']['controller']
|
self.base_url = config['unifi']['controller']
|
||||||
|
self.session = requests.Session()
|
||||||
|
self.session.verify = False
|
||||||
self.headers = {
|
self.headers = {
|
||||||
'X-API-KEY': config['unifi']['api_key'],
|
'X-API-KEY': config['unifi']['api_key'],
|
||||||
'Accept': 'application/json'
|
'Accept': 'application/json'
|
||||||
}
|
}
|
||||||
self.site_id = self._get_site_id()
|
self.site_id = self._get_site_id()
|
||||||
self.session = requests.Session()
|
|
||||||
self.session.verify = False
|
|
||||||
|
|
||||||
def _get_site_id(self):
|
def _get_site_id(self):
|
||||||
url = f"{self.base_url}/proxy/network/integration/v1/sites"
|
url = f"{self.base_url}/proxy/network/integration/v1/sites"
|
||||||
|
|||||||
Reference in New Issue
Block a user