Skip to content

Commit

Permalink
Fixed update_download_task
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonin Verdier authored and Quentame committed Oct 28, 2024
1 parent 8d2de40 commit 232fc8d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/freebox_api/access.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions src/freebox_api/api/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 232fc8d

Please sign in to comment.