Skip to content
This repository has been archived by the owner on Aug 18, 2023. It is now read-only.

Commit

Permalink
Merge pull request #6 from klaviyo/lambda-fix
Browse files Browse the repository at this point in the history
Lambda fix
  • Loading branch information
jon-batscha committed Apr 22, 2022
2 parents 3b7ffbb + 5a42e80 commit 8f95cda
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Klaviyo Python SDK

- SDK version: 1.0.2.20220329
- SDK version: 1.0.3.20220329

## Helpful Resources

Expand Down Expand Up @@ -30,7 +30,7 @@ This SDK is organized into the following resources:

## pip

You can install this library using `pip`.
You can install this library using [`pip`](https://pypi.org/project/klaviyo-sdk/).

Depending on your system configuration, you will need to run *one* of the following shell commands:

Expand Down Expand Up @@ -553,12 +553,13 @@ client.TrackIdentify.track_post(data=data)
## Refresher on catching exceptions:

```python
import klaviyo

try:
YOUR_CALL
except klaviyo.ApiException as e:
print(e.status, e.reason, e.body, e.headers)
except Exception as e:
print(e.status)
print(e.reason)
print(e.body)
print(e.headers)
```

## Namespace
Expand Down
2 changes: 1 addition & 1 deletion klaviyo_sdk/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def wrapped_func(person_id='PERSON_ID', params={}):

headers = {
"Accept": "application/json",
"user-agent" : "klaviyo-python-sdk/1.0.2.20220329"
"user-agent" : "klaviyo-python-sdk/1.0.3.20220329"
}

response = requests.request("PUT", url, headers=headers, params=querystring)
Expand Down
15 changes: 11 additions & 4 deletions swagger_client/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,26 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
configuration = Configuration()
self.configuration = configuration

self.pool = ThreadPool()
self._pool = None # Use the pool property to lazily initialize the ThreadPool.
self.rest_client = rest.RESTClientObject(configuration)
self.default_headers = {}
if header_name is not None:
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'klaviyo-python-sdk/1.0.2.20220329'
self.user_agent = 'klaviyo-python-sdk/1.0.3.20220329'

def __del__(self):
self.pool.close()
self.pool.join()
if self._pool is not None:
self._pool.close()
self._pool.join()

@property
def pool(self):
if self._pool is None:
self._pool = ThreadPool()
return self._pool

@property
def user_agent(self):
"""User agent for this API client"""
Expand Down
5 changes: 3 additions & 2 deletions swagger_client/models/people_exchange_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ def __init__(self, exchange_id='EXCHANGE_ID'): # noqa: E501
"""PeopleExchangeBody - a model defined in Swagger""" # noqa: E501
self._exchange_id = None
self.discriminator = None
if exchange_id is not None:
self.exchange_id = exchange_id
self.exchange_id = exchange_id

@property
def exchange_id(self):
Expand All @@ -60,6 +59,8 @@ def exchange_id(self, exchange_id):
:param exchange_id: The exchange_id of this PeopleExchangeBody. # noqa: E501
:type: str
"""
if exchange_id is None:
raise ValueError("Invalid value for `exchange_id`, must not be `None`") # noqa: E501

self._exchange_id = exchange_id

Expand Down

0 comments on commit 8f95cda

Please sign in to comment.