mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Fix pyload API statusServer doesn't take parameters (#35242)
* pyload API statusServer doesn't take parameters Remove json payload from API call to statusServer for retrieving current download speed. See maintainers message in: pyload/pyload#3622 (comment) Skip duplicated call to update function. * Lint sensor.py remove empty line
This commit is contained in:
parent
740d9c575e
commit
14190bd497
@ -60,7 +60,6 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
|
||||
try:
|
||||
pyloadapi = PyLoadAPI(api_url=url, username=username, password=password)
|
||||
pyloadapi.update()
|
||||
except (
|
||||
requests.exceptions.ConnectionError,
|
||||
requests.exceptions.HTTPError,
|
||||
@ -144,17 +143,11 @@ class PyLoadAPI:
|
||||
self.login = requests.post(f"{api_url}login", data=self.payload, timeout=5)
|
||||
self.update()
|
||||
|
||||
def post(self, method, params=None):
|
||||
def post(self):
|
||||
"""Send a POST request and return the response as a dict."""
|
||||
payload = {"method": method}
|
||||
|
||||
if params:
|
||||
payload["params"] = params
|
||||
|
||||
try:
|
||||
response = requests.post(
|
||||
f"{self.api_url}statusServer",
|
||||
json=payload,
|
||||
cookies=self.login.cookies,
|
||||
headers=self.headers,
|
||||
timeout=5,
|
||||
@ -170,4 +163,4 @@ class PyLoadAPI:
|
||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||
def update(self):
|
||||
"""Update cached response."""
|
||||
self.status = self.post("speed")
|
||||
self.status = self.post()
|
||||
|
Loading…
x
Reference in New Issue
Block a user