aboutsummaryrefslogtreecommitdiff
path: root/ShellyPy/gen2.py
diff options
context:
space:
mode:
Diffstat (limited to 'ShellyPy/gen2.py')
-rw-r--r--ShellyPy/gen2.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/ShellyPy/gen2.py b/ShellyPy/gen2.py
index 96747c9..e94a1f0 100644
--- a/ShellyPy/gen2.py
+++ b/ShellyPy/gen2.py
@@ -6,6 +6,7 @@ else:
JSONDecodeError = ValueError
from requests import post
+from requests.auth import HTTPDigestAuth
from .error import BadLogin, NotFound, BadResponse
@@ -50,7 +51,13 @@ class ShellyGen2(ShellyBase):
if values:
payload["params"] = values
- response = post(url, auth=self.__credentials__,
+ credentials = None
+ try:
+ credentials = auth=HTTPDigestAuth('admin', self.__credentials__[1])
+ except IndexError:
+ pass
+
+ response = post(url, auth=credentials,
json=payload,
timeout=self.__timeout__)