ihcsdk 2.8.7__tar.gz → 2.8.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ihcsdk might be problematic. Click here for more details.
- {ihcsdk-2.8.7 → ihcsdk-2.8.9}/PKG-INFO +1 -1
- {ihcsdk-2.8.7 → ihcsdk-2.8.9}/ihcsdk/ihcclient.py +26 -26
- {ihcsdk-2.8.7 → ihcsdk-2.8.9}/ihcsdk/ihcconnection.py +23 -14
- {ihcsdk-2.8.7 → ihcsdk-2.8.9}/ihcsdk/ihcsslconnection.py +5 -2
- {ihcsdk-2.8.7 → ihcsdk-2.8.9}/ihcsdk.egg-info/PKG-INFO +1 -1
- {ihcsdk-2.8.7 → ihcsdk-2.8.9}/setup.py +1 -1
- {ihcsdk-2.8.7 → ihcsdk-2.8.9}/MANIFEST.in +0 -0
- {ihcsdk-2.8.7 → ihcsdk-2.8.9}/ihcsdk/__init__.py +0 -0
- {ihcsdk-2.8.7 → ihcsdk-2.8.9}/ihcsdk/certs/ihc.crt +0 -0
- {ihcsdk-2.8.7 → ihcsdk-2.8.9}/ihcsdk/certs/ihc3.crt +0 -0
- {ihcsdk-2.8.7 → ihcsdk-2.8.9}/ihcsdk/ihccontroller.py +0 -0
- {ihcsdk-2.8.7 → ihcsdk-2.8.9}/ihcsdk.egg-info/SOURCES.txt +0 -0
- {ihcsdk-2.8.7 → ihcsdk-2.8.9}/ihcsdk.egg-info/dependency_links.txt +0 -0
- {ihcsdk-2.8.7 → ihcsdk-2.8.9}/ihcsdk.egg-info/requires.txt +0 -0
- {ihcsdk-2.8.7 → ihcsdk-2.8.9}/ihcsdk.egg-info/top_level.txt +0 -0
- {ihcsdk-2.8.7 → ihcsdk-2.8.9}/license.txt +0 -0
- {ihcsdk-2.8.7 → ihcsdk-2.8.9}/pyproject.toml +0 -0
- {ihcsdk-2.8.7 → ihcsdk-2.8.9}/readme.md +0 -0
- {ihcsdk-2.8.7 → ihcsdk-2.8.9}/setup.cfg +0 -0
|
@@ -120,7 +120,10 @@ class IHCSoapClient:
|
|
|
120
120
|
projectMinor = info.get("projectMinorRevision", 0)
|
|
121
121
|
buffer = io.BytesIO()
|
|
122
122
|
for s in range(self.get_project_number_of_segments()):
|
|
123
|
-
|
|
123
|
+
segment = self.get_project_segment(s, projectMajor, projectMinor)
|
|
124
|
+
if segment is False:
|
|
125
|
+
return False
|
|
126
|
+
buffer.write(segment)
|
|
124
127
|
return zlib.decompress(buffer.getvalue(), 16 + zlib.MAX_WBITS).decode(
|
|
125
128
|
"ISO-8859-1"
|
|
126
129
|
)
|
|
@@ -343,32 +346,31 @@ class IHCSoapClient:
|
|
|
343
346
|
|
|
344
347
|
def __get_value(resource_value):
|
|
345
348
|
"""Get a runtime value from the xml base on the type in the xml"""
|
|
346
|
-
if resource_value
|
|
349
|
+
if resource_value is None:
|
|
347
350
|
return None
|
|
348
351
|
valuetype = resource_value.attrib[
|
|
349
352
|
"{http://www.w3.org/2001/XMLSchema-instance}type"
|
|
350
353
|
].split(":")[1]
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
"WSBooleanValue":
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
"
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
"
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
"
|
|
368
|
-
|
|
369
|
-
"int":
|
|
370
|
-
|
|
371
|
-
|
|
354
|
+
result = resource_value.text
|
|
355
|
+
match valuetype:
|
|
356
|
+
case "WSBooleanValue":
|
|
357
|
+
result = resource_value.find("./ns2:value", IHCSoapClient.ihcns).text == "true"
|
|
358
|
+
case "WSIntegerValue":
|
|
359
|
+
result = int( resource_value.find("./ns2:integer", IHCSoapClient.ihcns).text)
|
|
360
|
+
case "WSFloatingPointValue":
|
|
361
|
+
result = round(float(resource_value.find("./ns2:floatingPointValue", IHCSoapClient.ihcns).text), 2)
|
|
362
|
+
case "WSEnumValue":
|
|
363
|
+
result = resource_value.find("./ns2:enumName", IHCSoapClient.ihcns).text
|
|
364
|
+
case "WSTimerValue":
|
|
365
|
+
return int(resource_value.find("./ns2:milliseconds", IHCSoapClient.ihcns).text)
|
|
366
|
+
case "WSTimeValue":
|
|
367
|
+
result = IHCSoapClient.get_time(resource_value)
|
|
368
|
+
case "WSDate":
|
|
369
|
+
result = IHCSoapClient.get_datetime(resource_value)
|
|
370
|
+
case "WSDateValue":
|
|
371
|
+
result = IHCSoapClient.get_date(resource_value)
|
|
372
|
+
case "int":
|
|
373
|
+
result = int(resource_value.text)
|
|
372
374
|
return result
|
|
373
375
|
|
|
374
376
|
def get_runtime_value(self, resourceid: int):
|
|
@@ -534,9 +536,7 @@ class IHCSoapClient:
|
|
|
534
536
|
|
|
535
537
|
def clear_user_log(self):
|
|
536
538
|
"""Clear the user log in the controller"""
|
|
537
|
-
|
|
538
|
-
"/ws/ConfigurationService", "clearUserLog", ""
|
|
539
|
-
)
|
|
539
|
+
self.connection.soap_action("/ws/ConfigurationService", "clearUserLog", "")
|
|
540
540
|
return
|
|
541
541
|
|
|
542
542
|
def get_system_info(self):
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"""Implements soap reqeust using the "requests" module"""
|
|
2
|
+
|
|
2
3
|
# pylint: disable=too-few-public-methods
|
|
3
4
|
import logging
|
|
4
5
|
import requests
|
|
5
6
|
import xml.etree.ElementTree
|
|
6
7
|
|
|
7
8
|
from urllib.parse import urlparse
|
|
9
|
+
from urllib3.util import Retry
|
|
10
|
+
from requests.adapters import HTTPAdapter
|
|
8
11
|
|
|
9
12
|
_LOGGER = logging.getLogger(__name__)
|
|
10
13
|
|
|
14
|
+
|
|
11
15
|
class IHCConnection(object):
|
|
12
16
|
"""Implements a http connection to the controller"""
|
|
13
17
|
|
|
@@ -24,6 +28,13 @@ class IHCConnection(object):
|
|
|
24
28
|
self.last_exception = None
|
|
25
29
|
self.last_response = None
|
|
26
30
|
self.session = requests.Session()
|
|
31
|
+
self.retries = Retry(
|
|
32
|
+
total=3,
|
|
33
|
+
backoff_factor=0.2,
|
|
34
|
+
status_forcelist=[502, 503, 504],
|
|
35
|
+
allowed_methods={"POST"},
|
|
36
|
+
)
|
|
37
|
+
self.session.mount("http://", HTTPAdapter(max_retries=self.retries))
|
|
27
38
|
|
|
28
39
|
def cert_verify(self):
|
|
29
40
|
return None
|
|
@@ -39,7 +50,7 @@ class IHCConnection(object):
|
|
|
39
50
|
"SOAPAction": action,
|
|
40
51
|
}
|
|
41
52
|
try:
|
|
42
|
-
_LOGGER.debug(
|
|
53
|
+
_LOGGER.debug("soap payload %s", payload)
|
|
43
54
|
self.last_exception = None
|
|
44
55
|
response = self.session.post(
|
|
45
56
|
url=self.url + service,
|
|
@@ -47,22 +58,20 @@ class IHCConnection(object):
|
|
|
47
58
|
data=payload,
|
|
48
59
|
verify=self.cert_verify(),
|
|
49
60
|
)
|
|
50
|
-
_LOGGER.debug(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if response.status_code != 200:
|
|
56
|
-
self.last_response = response
|
|
57
|
-
return False
|
|
58
|
-
try:
|
|
59
|
-
_LOGGER.debug( "soap request response %s",response.text)
|
|
61
|
+
_LOGGER.debug("soap request response status %d", response.status_code)
|
|
62
|
+
if response.status_code != 200:
|
|
63
|
+
self.last_response = response
|
|
64
|
+
return False
|
|
65
|
+
_LOGGER.debug("soap request response %s", response.text)
|
|
60
66
|
xdoc = xml.etree.ElementTree.fromstring(response.text)
|
|
61
67
|
if xdoc is None:
|
|
62
68
|
return False
|
|
69
|
+
return xdoc
|
|
70
|
+
except requests.exceptions.RequestException as exp:
|
|
71
|
+
_LOGGER.error("soap request exception %s", exp)
|
|
72
|
+
self.last_exception = exp
|
|
63
73
|
except xml.etree.ElementTree.ParseError as exp:
|
|
64
|
-
_LOGGER.error(
|
|
74
|
+
_LOGGER.error("soap request xml parse error %s", exp)
|
|
65
75
|
self.last_exception = exp
|
|
66
76
|
self.last_response = response
|
|
67
|
-
|
|
68
|
-
return xdoc
|
|
77
|
+
return False
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"""Implements soap reqeust using the "requests" module"""
|
|
2
|
+
|
|
2
3
|
# pylint: disable=too-few-public-methods
|
|
3
4
|
import os
|
|
4
5
|
import requests
|
|
@@ -6,7 +7,6 @@ import requests
|
|
|
6
7
|
from cryptography.x509 import load_pem_x509_certificate
|
|
7
8
|
from cryptography.hazmat.backends import default_backend
|
|
8
9
|
from cryptography.hazmat.primitives import hashes
|
|
9
|
-
from requests.adapters import HTTPAdapter
|
|
10
10
|
from requests.packages.urllib3.util.ssl_ import create_urllib3_context
|
|
11
11
|
|
|
12
12
|
from ihcsdk.ihcconnection import IHCConnection
|
|
@@ -19,7 +19,10 @@ class IHCSSLConnection(IHCConnection):
|
|
|
19
19
|
"""Initialize the IHCSSLConnection with a url for the controller"""
|
|
20
20
|
super(IHCSSLConnection, self).__init__(url)
|
|
21
21
|
self.cert_file = os.path.dirname(__file__) + "/certs/ihc3.crt"
|
|
22
|
-
self.session.mount(
|
|
22
|
+
self.session.mount(
|
|
23
|
+
"https://",
|
|
24
|
+
CertAdapter(self.get_fingerprint_from_cert(), max_retries=self.retries),
|
|
25
|
+
)
|
|
23
26
|
|
|
24
27
|
def get_fingerprint_from_cert(self):
|
|
25
28
|
"""Get the fingerprint from the certificate"""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|