Skip to content

Commit

Permalink
More minor fixes to prevent uneccssary logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
alexmohr committed Mar 31, 2018
1 parent 9df445b commit ee6fa0f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
author = 'Alexander Mohr',
author_email = 'sonyapilib@mohr.io',
url = 'https://github.com/alexmohr/sonyapilib', # use the URL to the github repo
download_url = 'https://codeload.github.com/alexmohr/sonyapilib/tar.gz/0.3',
download_url = 'https://codeload.github.com/alexmohr/sonyapilib/tar.gz/0.3.7',
keywords = ['soap', 'sony', 'api'], # arbitrary keywords
classifiers = [],
install_requires=[
Expand Down
10 changes: 6 additions & 4 deletions sonyapilib/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,9 @@ def post_soap_request(self, url, params, action):
params +\
"</SOAP-ENV:Body>" +\
"</SOAP-ENV:Envelope>"
return self.send_http(url, method=HttpMethod.POST,
headers=headers, data=data).content.decode("utf-8")
response = self.send_http(url, method=HttpMethod.POST,headers=headers, data=data)
if response is not None:
return response.content.decode("utf-8")

def send_req_ircc(self, params, log_errors=True):
"""Send an IRCC command via HTTP to Sony Bravia."""
Expand All @@ -507,17 +508,18 @@ def get_playing_status(self):

action = "urn:schemas-upnp-org:service:AVTransport:1#GetTransportInfo"


content = self.post_soap_request(
url=self.av_transport_url, params=data, action=action)
if None is content:
return "OFF"
response = xml.etree.ElementTree.fromstring(content)
state = response.find(".//CurrentTransportState").text
return state

def get_power_status(self):
url = self.actionlist_url
try:
self.send_http(url, HttpMethod.GET,
responst = self.send_http(url, HttpMethod.GET,
log_errors=False, raise_errors=True)
except Exception as ex:
_LOGGER.debug(ex)
Expand Down

0 comments on commit ee6fa0f

Please sign in to comment.