Allow API connection over HTTPS

This commit is contained in:
David Beitey
2019-09-15 11:11:21 +10:00
parent 4ebc0a2c97
commit 1f5944801c
3 changed files with 9 additions and 7 deletions

View File

@@ -5,8 +5,9 @@ from resthandle import Request
class APIHandler:
def __init__(self, ip):
self.url = "http://" + ip + "/cgi-bin/api.cgi"
def __init__(self, ip, https=False):
scheme = 'https' if https else 'http'
self.url = f"{scheme}://{ip}/cgi-bin/api.cgi"
self.token = None
# Token