Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com

- API version: 5.11.0
- Package version: 5.11.0
- Package version: 5.11.1

## Requirements

Expand Down
2 changes: 1 addition & 1 deletion onesignal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"""


__version__ = "5.11.0"
__version__ = "5.11.1"

# import ApiClient
from onesignal.api_client import ApiClient
Expand Down
4 changes: 2 additions & 2 deletions onesignal/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'OpenAPI-Generator/5.11.0/python'
self.user_agent = 'OpenAPI-Generator/5.11.1/python'

def __enter__(self):
return self
Expand Down Expand Up @@ -142,7 +142,7 @@ def __call_api(
# header parameters
header_params = header_params or {}
header_params.update(self.default_headers)
header_params['OS-Usage-Data'] = "kind=sdk, sdk-name=onesignal-python, version=5.11.0"
header_params['OS-Usage-Data'] = "kind=sdk, sdk-name=onesignal-python, version=5.11.1"
if self.cookie:
header_params['Cookie'] = self.cookie
if header_params:
Expand Down
2 changes: 1 addition & 1 deletion onesignal/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def to_debug_report(self):
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: 5.11.0\n"\
"SDK Package Version: 5.11.0".\
"SDK Package Version: 5.11.1".\
format(env=sys.platform, pyversion=sys.version)

def get_host_settings(self):
Expand Down
10 changes: 8 additions & 2 deletions onesignal/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ def __init__(self, resp):

def getheaders(self):
"""Returns a dictionary of the response headers."""
return self.urllib3_response.getheaders()
return self.urllib3_response.headers

def getheader(self, name, default=None):
"""Returns a given response header."""
return self.urllib3_response.getheader(name, default)
return self.urllib3_response.headers.get(name, default)


class RESTClientObject(object):
Expand Down Expand Up @@ -215,6 +215,12 @@ def request(self, method, url, query_params=None, headers=None,
logger.debug("response body: %s", r.data)

if not 200 <= r.status <= 299:
# Ensure the exception constructors always receive a RESTResponse:
# they call getheaders(), which raw urllib3 2.x responses no longer
# provide. When _preload_content is True, r is already wrapped.
if not isinstance(r, RESTResponse):
r = RESTResponse(r)

if r.status == 401:
raise UnauthorizedException(http_resp=r)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from setuptools import setup, find_packages # noqa: H301

NAME = "onesignal_python_api"
VERSION = "5.11.0"
VERSION = "5.11.1"
# To install the library, run the following
#
# python setup.py install
Expand Down