hacf-fr / freebox-api

Manage your freebox in Python using the Freebox OS API
https://readthedocs.org/projects/freebox-api/
GNU General Public License v3.0
31 stars 17 forks source link

Fixed add_download_task_from_url #635

Open lacaulac opened 7 months ago

lacaulac commented 7 months ago

Added an optional parameter to access.py's post function, as the downloads/add/ endpoint's input must be formatted "using “application/x-www-form-urlencoded” (or “multipart/form-data” for file upload)". This allowed me to fix Download.add_download_task_from_url, but I have a big hunch that Download.add_download_task_from_file could also be affected by this issue. I also fixed Download.add_download_task_from_url's documentation that previously indicated that its parameter was supposed to be a string even though the typing indicated in the function declaration is of a Dict[str, Any]. I would also suggest referencing the download_url_schema variable in Download.add_download_task_from_url's documentation.

PS : Sorry for the typo in the commit name on my side !

Tests results (tell me if that's not what you're looking for) :

nox > Session coverage was successful.
nox > Ran multiple sessions:
nox > * pre-commit: skipped
nox > * safety: skipped
nox > * mypy-3.11: skipped
nox > * mypy-3.10: success
nox > * mypy-3.9: skipped
nox > * mypy-3.8: skipped
nox > * tests-3.11: skipped
nox > * tests-3.10: success
nox > * tests-3.9: skipped
nox > * tests-3.8: skipped
nox > * typeguard-3.11: skipped
nox > * typeguard-3.10: success
nox > * typeguard-3.9: skipped
nox > * typeguard-3.8: skipped
nox > * xdoctest-3.11: skipped
nox > * xdoctest-3.10: success
nox > * xdoctest-3.9: skipped
nox > * xdoctest-3.8: skipped
nox > * docs-build: skipped
nox > * coverage: success