forked from platypush/platypush
[chore] LINT fixes.
This commit is contained in:
parent
3dab232d33
commit
5fac324b43
1 changed files with 15 additions and 6 deletions
|
@ -20,15 +20,18 @@ class WemoRunner:
|
||||||
state_name = action.value[3:]
|
state_name = action.value[3:]
|
||||||
|
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
'http://{}:{}/upnp/control/basicevent1'.format(device, port),
|
f'http://{device}:{port}/upnp/control/basicevent1',
|
||||||
headers={
|
headers={
|
||||||
'User-Agent': '',
|
'User-Agent': '',
|
||||||
'Accept': '',
|
'Accept': '',
|
||||||
'Content-Type': 'text/xml; charset="utf-8"',
|
'Content-Type': 'text/xml; charset="utf-8"',
|
||||||
'SOAPACTION': '\"urn:Belkin:service:basicevent:1#{}\"'.format(action.value),
|
'SOAPACTION': f'\"urn:Belkin:service:basicevent:1#{action.value}\"',
|
||||||
},
|
},
|
||||||
data=re.sub('\s+', ' ', textwrap.dedent(
|
data=re.sub(
|
||||||
'''
|
r'\s+',
|
||||||
|
' ',
|
||||||
|
textwrap.dedent(
|
||||||
|
'''
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
|
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
|
||||||
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
||||||
|
@ -38,8 +41,14 @@ class WemoRunner:
|
||||||
</u:{action}
|
</u:{action}
|
||||||
></s:Body>
|
></s:Body>
|
||||||
</s:Envelope>
|
</s:Envelope>
|
||||||
'''.format(action=action.value, state=state_name,
|
'''.format(
|
||||||
value=value if value is not None else ''))))
|
action=action.value,
|
||||||
|
state=state_name,
|
||||||
|
value=value if value is not None else '',
|
||||||
|
)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
dom = parseString(response.text)
|
dom = parseString(response.text)
|
||||||
return dom.getElementsByTagName(state_name).item(0).firstChild.data
|
return dom.getElementsByTagName(state_name).item(0).firstChild.data
|
||||||
|
|
Loading…
Reference in a new issue