[GH-ISSUE #104] proper checksum-algorithm value passing in the request #55

Closed
opened 2026-02-27 15:46:12 +03:00 by kerem · 3 comments
Owner

Originally created by @NlVlN on GitHub (Jul 15, 2022).
Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/104

Originally assigned to: @jhollowe on GitHub.

Documentation (https://proxmoxer.github.io/docs/1.2/examples/files/#downloading-files-to-pve) says that it is possible to verify the checksum by providing the checksum and the checksum-algorithm like in the example:
proxmox.nodes("<node_name>").storage("<storage_name>")("download-url").post(url=sourceURL, content="<content_type>", filename="<file_name.extension>", checksum="<hash>", "checksum-algorithm": "<md5 | sha1 | sha224 | sha256 | sha384 | sha512>")

However running the following example;
proxmox.nodes("proxmox").storage("local")("download-url").post(url=iso_url, content="iso", filename=image_name, checksum=sha256sum, "checksum-algorithm": "sha256")
produces "SyntaxError: positional argument follows keyword argument" error near checksum-algorithm parameter.

Is there another method to pass the checksum algorithm to the request, for example, through the variable 'params' or 'data'? I've tried quite a few options and none of them work.

Originally created by @NlVlN on GitHub (Jul 15, 2022). Original GitHub issue: https://github.com/proxmoxer/proxmoxer/issues/104 Originally assigned to: @jhollowe on GitHub. Documentation (https://proxmoxer.github.io/docs/1.2/examples/files/#downloading-files-to-pve) says that it is possible to verify the checksum by providing the checksum and the checksum-algorithm like in the example: `proxmox.nodes("<node_name>").storage("<storage_name>")("download-url").post(url=sourceURL, content="<content_type>", filename="<file_name.extension>", checksum="<hash>", "checksum-algorithm": "<md5 | sha1 | sha224 | sha256 | sha384 | sha512>")` However running the following example; `proxmox.nodes("proxmox").storage("local")("download-url").post(url=iso_url, content="iso", filename=image_name, checksum=sha256sum, "checksum-algorithm": "sha256")` produces "SyntaxError: positional argument follows keyword argument" error near `checksum-algorithm` parameter. Is there another method to pass the checksum algorithm to the request, for example, through the variable 'params' or 'data'? I've tried quite a few options and none of them work.
kerem 2026-02-27 15:46:12 +03:00
Author
Owner

@jhollowe commented on GitHub (Aug 4, 2022):

I know I ran into this when I was testing the downloader, but I forget how I got around it. I'm planning on adding a file upload/download tools module to version 2.0, but haven't got around to that yet.

I think you can create a dict of the arguments you want to pass in and then unpack those into the post function call.

e.g. (untested code)

download_args = {"URL": iso_url, "content": "iso", "filename": image_name, "checksum": sha256sum, "checksum-algorithm": "sha256"}
proxmox.nodes("proxmox").storage("local")("download-url").post(**download_args)

Let me know if that works.

<!-- gh-comment-id:1204621485 --> @jhollowe commented on GitHub (Aug 4, 2022): I know I ran into this when I was testing the downloader, but I forget how I got around it. I'm planning on adding a file upload/download tools module to version 2.0, but haven't got around to that yet. I think you can create a dict of the arguments you want to pass in and then unpack those into the `post` function call. e.g. (untested code) ```python download_args = {"URL": iso_url, "content": "iso", "filename": image_name, "checksum": sha256sum, "checksum-algorithm": "sha256"} proxmox.nodes("proxmox").storage("local")("download-url").post(**download_args) ``` Let me know if that works.
Author
Owner

@jhollowe commented on GitHub (Sep 18, 2022):

Did the above suggestion work for you?

<!-- gh-comment-id:1250392231 --> @jhollowe commented on GitHub (Sep 18, 2022): Did the above suggestion work for you?
Author
Owner

@NlVlN commented on GitHub (Oct 30, 2022):

Thanks! Works like a charm.
The only think I had to do was to change the first dict key to lowercase (‘URL’ to ‘url’).

<!-- gh-comment-id:1296189107 --> @NlVlN commented on GitHub (Oct 30, 2022): Thanks! Works like a charm. The only think I had to do was to change the first dict key to lowercase (‘URL’ to ‘url’).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/proxmoxer#55
No description provided.