Extensions: send to url: blender version, platform and access token #122234

Closed
Dalai Felinto wants to merge 1 commits from ideasman42:pr-extensions-pass-params into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

Get the parameters to use for the header (access token) as well as the
extra query arguments for the extension API listing.

The UI part of the access token was already implemented #121856

Get the parameters to use for the header (access token) as well as the extra query arguments for the extension API listing. The UI part of the access token was already implemented #121856
Dalai Felinto added 1 commit 2024-05-24 20:21:14 +02:00
Get the parameters to use for the header (access token) as well as the
extra query arguments for the extension API listing.
Dalai Felinto added this to the Python API project 2024-05-24 20:21:21 +02:00
Dalai Felinto requested review from Campbell Barton 2024-05-24 20:21:29 +02:00
Campbell Barton requested changes 2024-05-28 08:57:33 +02:00
@ -197,0 +200,4 @@
system = platform.system()
machine = platform.machine()
# Map platform system and machine to the desired format

I'd rather not hard code values here if possible:

Suggest:

    system_replace = {"darwin", "macos"}
    system = platform.system().lower()
    machine = platform.machine().lower()
    return "{:s}-{:s}".format(
        system_replace.get(system, system),
        machine,
    )

Uses on other platforms should not be prevented from using or setting up their own extensions repositories, even if extensions.blender.org doesn't support their platform.

I'd rather not hard code values here if possible: Suggest: ``` system_replace = {"darwin", "macos"} system = platform.system().lower() machine = platform.machine().lower() return "{:s}-{:s}".format( system_replace.get(system, system), machine, ) ``` Uses on other platforms should not be prevented from using or setting up their own extensions repositories, even if extensions.blender.org doesn't support their platform.
Author
Owner

+1

+1
@ -321,6 +329,8 @@ def repo_upgrade(
"--local-dir", directory,
"--remote-url", remote_url,
"--online-user-agent", online_user_agent,
"--blender_version", blender_version,

Should be --blender-version.

Should be `--blender-version`.
@ -379,6 +391,8 @@ def pkg_install(
"--local-dir", directory,
"--remote-url", remote_url,
"--online-user-agent", online_user_agent,
"--blender_version", blender_version,

Should be --blender-version.

Should be `--blender-version`.
@ -905,13 +905,49 @@ class PathPatternMatch:
# -----------------------------------------------------------------------------
# URL Downloading

I don't think making this Optional is needed, the value url_retrieve_to_data_iter receives is never None.

I don't think making this `Optional` is needed, the value `url_retrieve_to_data_iter` receives is never None.
@ -906,2 +906,4 @@
# URL Downloading
def remove_empty_params(params: Optional[Dict[str, str]] = None) -> dict:

dict -> Dict[str, str]

`dict` -> `Dict[str, str]`
@ -908,0 +929,4 @@
# Encode all parameters into a new query string
new_query = urllib.parse.urlencode(all_params)
# Combine the scheme, netloc, path, and new query string to form the new URL

End sentences with full-stop, add trailing comma for all wrapped arguments.

End sentences with full-stop, add trailing comma for all wrapped arguments.
@ -1937,6 +1996,45 @@ def generic_arg_online_user_agent(subparse: argparse.ArgumentParser) -> None:
)
def generic_arg_blender_version_param(subparse: argparse.ArgumentParser) -> None:

We could consider including all parameters in the URL without adding arguments for each (if we need the URL without parameters they can be stripped out). Would there be any down-sides to this?

We could consider including all parameters in the URL without adding arguments for each (if we need the URL without parameters they can be stripped out). Would there be any down-sides to this?
Author
Owner

It is fine as long as we call params_to_url() for that.

We need to keep in mind that the original url may already have parameters, and we need to combine all of them together.

e.g., url=http://mysite.com/api?user=dalai
final url=http://mysite.com/api?user=dalai&blender_version=4.2.0&platform=macos-arm64

The params_to_url() is handling this (and things like trailing #).

It is fine as long as we call params_to_url() for that. We need to keep in mind that the original url may already have parameters, and we need to combine all of them together. e.g., url=http://mysite.com/api?user=dalai final url=http://mysite.com/api?user=dalai&blender_version=4.2.0&platform=macos-arm64 The params_to_url() is handling this (and things like trailing #).
Author
Owner

Reply to some of the comments, feel free to take over the PR.

Reply to some of the comments, feel free to take over the PR.

Committed the blender_version part of this PR b15bc1b5bb, the platform change is part of a new PR !122371.

Committed the blender_version part of this PR b15bc1b5bb1926c0c3262952ded1224678e3cbf8, the platform change is part of a new PR !122371.
Campbell Barton closed this pull request 2024-05-28 14:32:36 +02:00

Pull request closed

Sign in to join this conversation.
No reviewers
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset System
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Asset Browser Project
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
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: blender/blender#122234
No description provided.