Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed add_download_task_from_url #635

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

lacaulac
Copy link

@lacaulac lacaulac commented Jan 28, 2024

  1. 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.

  2. 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

@Quentame
Copy link
Member

Hey !

For the first remark, so sending data to string type automatically make the request be encoded to “application/x-www-form-urlencoded” or “multipart/form-data” ? nothing else to add ?

For the second remark, this was wanted to work as is: add_download_task_from_url(string) would be a shortand of add_download_task(dict), but only using download_url, same for add_download_task_from_file(string) for download_file. But YES, this part needs to be reworked.

Thanks

@Quentame Quentame mentioned this pull request Oct 28, 2024
src/freebox_api/access.py Outdated Show resolved Hide resolved
@lacaulac
Copy link
Author

Hi ! I must say I don't exactly remember the specifics, as I wrote these pieces of code back in January. I added the changes you proposed to make the code more concise.

Have a great day !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants