Skip to content

Crash on modern Python environments due to urllib3 >= 2.0.0 deprecation #156

Description

@Anshu666666

File: Swagger Codegen's underlying urllib3 dependency usage (often surfaces when the API Client or Rest Client initializes connection pools). Location: The error surfaces via AttributeError: module 'urllib3' has no attribute 'get_host'

Issue Description: The Upstox Python SDK (which is auto-generated by an older version of swagger-codegen) relies on the urllib3.get_host() utility function in its networking logic.

Why this is a bug: The urllib3.get_host function was officially deprecated and removed in urllib3 version 2.0.0. Because the Upstox SDK's setup.py does not strictly pin urllib3 < 2.0.0, any developer installing the SDK on a modern Python environment will likely pull urllib3 v2.x. The moment the SDK attempts to make an API call or parse a URL, it crashes instantly with an AttributeError.

Proposed Fix for the Maintainers:

Short-term fix: Update setup.py to strictly pin urllib3 >= 1.25.3, < 2.0.0.
Long-term fix: Re-generate the SDK using a modern OpenAPI Generator (which has replaced the deprecated swagger-codegen) that uses urllib3.util.parse_url(url) instead of the deprecated urllib3.get_host(url).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions