diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bc3b85..9572383 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 10.1.0 + +* BaseAPIClient: add request_session constructor argument + ## 10.0.1 * Fix get_received_texts_iterator() method diff --git a/notifications_python_client/__init__.py b/notifications_python_client/__init__.py index 436df44..887bf8d 100644 --- a/notifications_python_client/__init__.py +++ b/notifications_python_client/__init__.py @@ -7,7 +7,7 @@ # # -- http://semver.org/ -__version__ = "10.0.1" +__version__ = "10.1.0" from notifications_python_client.errors import ( # noqa REQUEST_ERROR_MESSAGE, diff --git a/notifications_python_client/base.py b/notifications_python_client/base.py index 333c346..49a4326 100644 --- a/notifications_python_client/base.py +++ b/notifications_python_client/base.py @@ -13,7 +13,13 @@ class BaseAPIClient: - def __init__(self, api_key, base_url="https://api.notifications.service.gov.uk", timeout=30): + def __init__( + self, + api_key, + base_url="https://api.notifications.service.gov.uk", + timeout=30, + request_session=None, + ): """ Initialise the client Error if either of base_url or secret missing @@ -32,7 +38,7 @@ def __init__(self, api_key, base_url="https://api.notifications.service.gov.uk", self.service_id = service_id self.api_key = api_key self.timeout = timeout - self.request_session = requests.Session() + self.request_session = request_session or requests.Session() def put(self, url, data): return self.request("PUT", url, data=data)