Skip to content

aas.backend: Support urllib3 version 2#294

Merged
s-heppner merged 1 commit into
eclipse-basyx:mainfrom
JGrothoff:main
Sep 20, 2024
Merged

aas.backend: Support urllib3 version 2#294
s-heppner merged 1 commit into
eclipse-basyx:mainfrom
JGrothoff:main

Conversation

@JGrothoff
Copy link
Copy Markdown
Contributor

The previous version contraint urllib3>=1.26,<2.0 is verry restrictive.
I need to use the SDK in a project together with other libs (e.g. gradio) that require urlib3 >= 2.

I widened the version constraint according to urllib3 migration guide and did't see any deprecation warnings (hopefully i turned them on correctly).

@classmethod
def do_request(cls, url: str, method: str = "GET", additional_headers: Dict[str, str] = {},
body: Optional[bytes] = None) -> Dict[str, Any]:
body: Optional[bytes] = None) -> MutableMapping[str, Any]:
Copy link
Copy Markdown
Contributor Author

@JGrothoff JGrothoff Sep 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of changing the return type to the more generic MutableMappingwe could also add HTTPHeaderDict as Union.
Alternatively we can leave Dict return type and transform the response.headers into a normal dict in line 158. However this produces additional overhead, e.g.:
return {key: value for key, value in response.headers.items()}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no strong opinion on which type should be used here.

@s-heppner
Copy link
Copy Markdown
Member

Hi @JGrothoff thank you for your contribution!

I'm happy to introduce urllib3 >= 2 to our SDK. Just as it so happened we switched from setup.py and requirements.txt to the more modern approach of using pyproject.toml (See #290). Could you adapt your PR accordingly, please?

@JGrothoff
Copy link
Copy Markdown
Contributor Author

Hi @s-heppner, thank you for the review. I adapted the files accordingly.

Copy link
Copy Markdown
Member

@s-heppner s-heppner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you very much for your contribution!

@s-heppner s-heppner merged commit aeeb59e into eclipse-basyx:main Sep 20, 2024
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