Skip to content

Incompatible with urllib3 >= 2.6.0: HTTPResponse.getheaders() and getheader() have been removed #26

@Nam-kyu

Description

@Nam-kyu

Summary

sendbird-platform-sdk-python is incompatible with urllib3 >= 2.6.0 due to the use of the removed HTTPResponse.getheaders() and HTTPResponse.getheader() methods.

Environment

  • Python version: 3.x
  • urllib3 version: 2.6.0
  • sendbird-platform-sdk version: latest

Error

When using urllib3 >= 2.6.0, the following error occurs:

AttributeError: 'HTTPResponse' object has no attribute 'getheaders'
# or
AttributeError: 'HTTPResponse' object has no attribute 'getheader'

Root Cause

The HTTPResponse.getheaders() and HTTPResponse.getheader() methods were deprecated in urllib3 2.0.0 and have been removed in urllib3 2.6.0.

From the urllib3 2.6.0 changelog:

Removed the HTTPResponse.getheaders() method in favor of HTTPResponse.headers. Removed the HTTPResponse.getheader(name, default) method in favor of HTTPResponse.headers.get(name, default).

Suggested Fix

# Before
response.getheaders()
response.getheader(name, default)

# After  
response.headers
response.headers.get(name, default)

References

Workaround

Until this is fixed, pin urllib3 to a version below 2.6.0:

urllib3<2.6.0

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