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:
- The SDK should be updated to use the urllib3 2.x API (
.headers.get() instead of .getheader())
- Or the package should pin
urllib3>=1.25.3,<2 until fixed
Code of Conduct