Skip to content

Conversation

@shuangkun
Copy link
Member

@shuangkun shuangkun commented Dec 7, 2025

fix test-python-sdk error

Add compatibility layer for urllib3 HTTPResponse getheader and getheaders methods to support both old and new versions of urllib3.

  • Check for getheader/getheaders methods (urllib3 < 2.0)
  • Fall back to headers attribute (urllib3 >= 2.0)
  • Fixes AttributeError when using urllib3 2.x in Python SDK tests

Motivation

Modifications

Verification

Documentation

Add compatibility layer for urllib3 HTTPResponse getheader and getheaders
methods to support both old and new versions of urllib3.

- Check for getheader/getheaders methods (urllib3 < 2.0)
- Fall back to headers attribute (urllib3 >= 2.0)
- Fixes AttributeError when using urllib3 2.x in Python SDK tests

Signed-off-by: shuangkun <[email protected]>
Add Python script to automatically apply urllib3 compatibility fix to rest.py
after OpenAPI Generator generates it. This ensures the fix persists even when
the SDK is regenerated.

- Create fix_urllib3_compat.py script to apply compatibility fix
- Update Makefile to run the script after generation
- Fixes compatibility with urllib3 >= 2.0 which removed getheader/getheaders methods

Signed-off-by: shuangkun <[email protected]>
@MasonM
Copy link
Member

MasonM commented Dec 8, 2025

Thanks @shuangkun! Since we already decided to remove the Python SDK, it's probably best to move forward with #14995 instead of adding hacks to patch it.

@Joibel
Copy link
Member

Joibel commented Dec 8, 2025

I've merged #14995 so we don't need this on main. I've backported it to 3.6 and 3.7 though as we're not removing the SDK there. Thank you for the work on it.

@Joibel Joibel closed this Dec 8, 2025
@shuangkun
Copy link
Member Author

I've merged #14995 so we don't need this on main. I've backported it to 3.6 and 3.7 though as we're not removing the SDK there. Thank you for the work on it.

Thanks!

Joibel added a commit that referenced this pull request Dec 8, 2025
…erry-pick #15117 for 3.7) (#15120)

Signed-off-by: shuangkun <[email protected]>
Co-authored-by: shuangkun <[email protected]>
Joibel added a commit that referenced this pull request Dec 8, 2025
…erry-pick #15117 for 3.6) (#15121)

Signed-off-by: shuangkun <[email protected]>
Co-authored-by: shuangkun <[email protected]>
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.

3 participants