Skip to content

[Bug]: Incompatible with urllib3 2.x - AttributeError: 'HTTPResponse' object has no attribute 'getheader' #58

Description

@khaapamyaki

What happened?

The latest version of the API library (2.2.1) throws an exception when creating a notification with urllib3 2.x installed.

Error:
AttributeError: 'HTTPResponse' object has no attribute 'getheader'

The issue is in onesignal/rest.py line 43, where RESTResponse.getheader() calls self.urllib3_response.getheader(). This method was removed in urllib3 2.0 (April 2023).

The package declares urllib3>=1.25.3 with no upper bound, but the code is not compatible with urllib3 2.x.

Steps to reproduce?

1. Install onesignal-python-api==2.2.1 with urllib3>=2.0 (e.g., urllib3==2.5.0)
2. Create and send a notification using the API
3. Observe AttributeError: 'HTTPResponse' object has no attribute 'getheader'

What did you expect to happen?

The notification should be sent successfully. Either:

  1. The SDK should be updated to use the urllib3 2.x API (.headers.get() instead of .getheader())
  2. Or the package should pin urllib3>=1.25.3,<2 until fixed

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions