From 232fc8dae8817e8f9afe46cbcdd3603f93e80ea8 Mon Sep 17 00:00:00 2001 From: Antonin Verdier Date: Sun, 28 Jan 2024 22:34:56 +0100 Subject: [PATCH] Fixed update_download_task --- src/freebox_api/access.py | 7 +++++-- src/freebox_api/api/download.py | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/freebox_api/access.py b/src/freebox_api/access.py index e23fad45..f75c4363 100644 --- a/src/freebox_api/access.py +++ b/src/freebox_api/access.py @@ -138,12 +138,15 @@ async def get( return await self._perform_request(self.session.get, end_url) async def post( - self, end_url: str, payload: Optional[Dict[str, Any]] = None + self, end_url: str, payload: Optional[Dict[str, Any]] = None, json_transform: bool = True ) -> Dict[str, Any]: """ Send post request and return results """ - data = json.dumps(payload) if payload else None + if json_transform: + data = json.dumps(payload) if payload else None + else: + data = payload if payload else None return await self._perform_request(self.session.post, end_url, data=data) # type: ignore async def put( diff --git a/src/freebox_api/api/download.py b/src/freebox_api/api/download.py index 5609551c..682add4f 100644 --- a/src/freebox_api/api/download.py +++ b/src/freebox_api/api/download.py @@ -108,9 +108,9 @@ async def add_download_task_from_url( """ Add download from url - download_url : `str` + download_url : `dict` """ - return await self._access.post("downloads/add/", download_url) + return await self._access.post("downloads/add/", download_url, False) async def add_download_task_from_file( self, download_file: Dict[str, Any]