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,14 +20,17 @@ class WemoRunner:
|
|||
state_name = action.value[3:]
|
||||
|
||||
response = requests.post(
|
||||
'http://{}:{}/upnp/control/basicevent1'.format(device, port),
|
||||
f'http://{device}:{port}/upnp/control/basicevent1',
|
||||
headers={
|
||||
'User-Agent': '',
|
||||
'Accept': '',
|
||||
'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"?>
|
||||
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
|
||||
|
@ -38,8 +41,14 @@ class WemoRunner:
|
|||
</u:{action}
|
||||
></s:Body>
|
||||
</s:Envelope>
|
||||
'''.format(action=action.value, state=state_name,
|
||||
value=value if value is not None else ''))))
|
||||
'''.format(
|
||||
action=action.value,
|
||||
state=state_name,
|
||||
value=value if value is not None else '',
|
||||
)
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
dom = parseString(response.text)
|
||||
return dom.getElementsByTagName(state_name).item(0).firstChild.data
|
||||
|
|
Loading…
Reference in a new issue