Skip to content

Commit

Permalink
More future warnings fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dingusdk committed Jan 23, 2020
1 parent ee3a3fd commit ada19ac
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions ihcsdk/ihcclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def get_runtime_value(self, resourceid: int):
xdoc = self.connection.soap_action('/ws/ResourceInteractionService',
'getResourceValue',
payload)
if not xdoc:
if xdoc == False:
return False
boolresult = xdoc.find(
'./SOAP-ENV:Body/ns1:getRuntimeValue2/ns1:value/ns2:value',
Expand Down Expand Up @@ -227,7 +227,7 @@ def wait_for_resource_value_changes(self, wait: int=10):
""".format(timeout=wait)
xdoc = self.connection.soap_action('/ws/ResourceInteractionService',
'getResourceValue', payload)
if not xdoc:
if xdoc == False:
return False
result = xdoc.findall(
'./SOAP-ENV:Body/ns1:waitForResourceValueChanges2/ns1:arrayItem',
Expand Down
2 changes: 2 additions & 0 deletions ihcsdk/ihcconnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def soap_action(self, service, action, payloadbody):
self.cookies = response.cookies
try:
xdoc = xml.etree.ElementTree.fromstring(response.text)
if xdoc is None:
return False
except xml.etree.ElementTree.ParseError as exp:
self.last_exception = exp
self.last_response = response
Expand Down
2 changes: 2 additions & 0 deletions ihcsdk/ihccurlconnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def soap_action(self, service, action, payloadbody):
return False
try:
xdoc = xml.etree.ElementTree.fromstring(body)
if xdoc is None:
return False
except xml.etree.ElementTree.ParseError:
return False
return xdoc
2 changes: 2 additions & 0 deletions ihcsdk/ihcsslconnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def soap_action(self, service, action, payloadbody):
return False
try:
xdoc = xml.etree.ElementTree.fromstring(response.text)
if xdoc is None:
return False
except xml.etree.ElementTree.ParseError:
return False
return xdoc
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name='ihcsdk',
version='2.4.0',
version='2.5.0',
description='IHC Python SDK',
long_description=("SDK for connection to the LK IHC Controller. "
"Made for interfacing to home assistant"),
Expand Down

0 comments on commit ada19ac

Please sign in to comment.