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

Commit

Permalink
added get-profile-id endpoint, added 524 to retry error codes, fixed …
Browse files Browse the repository at this point in the history
…spec bug (stray parameter and unnecessary description)
  • Loading branch information
jon-batscha committed Jun 22, 2022
1 parent 8f95cda commit 2d44596
Show file tree
Hide file tree
Showing 15 changed files with 236 additions and 77 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Klaviyo Python SDK

- SDK version: 1.0.3.20220329
- SDK version: 1.0.4.20220329

## Helpful Resources

Expand Down Expand Up @@ -415,6 +415,15 @@ client.Profiles.get_profile(person_id)



#### [Get Profile ID](https://developers.klaviyo.com/en/reference/get-profile-id)

```python
client.Profiles.get_profile_id(email=email, phone_number=phone_number, external_id=external_id)
```




#### [Get Profile's Events for a Specific Metric](https://developers.klaviyo.com/en/reference/profile-metric-timeline)

```python
Expand Down
4 changes: 2 additions & 2 deletions klaviyo_sdk/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, api_key,test_host=None, max_delay=60, max_retries=3):

self.api_key = api_key

self.retry_codes = [429,503,504]
self.retry_codes = [429,503,504,524]

self.retry_logic = tenacity.retry(
reraise=True,
Expand Down 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.3.20220329"
"user-agent" : "klaviyo-python-sdk/1.0.4.20220329"
}

response = requests.request("PUT", url, headers=headers, params=querystring)
Expand Down
5 changes: 3 additions & 2 deletions swagger_client/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,20 @@
from swagger_client.models.inline_response2001 import InlineResponse2001
from swagger_client.models.inline_response20010 import InlineResponse20010
from swagger_client.models.inline_response20011 import InlineResponse20011
from swagger_client.models.inline_response20011_data import InlineResponse20011Data
from swagger_client.models.inline_response20012 import InlineResponse20012
from swagger_client.models.inline_response20012_data import InlineResponse20012Data
from swagger_client.models.inline_response20013 import InlineResponse20013
from swagger_client.models.inline_response20014 import InlineResponse20014
from swagger_client.models.inline_response2002 import InlineResponse2002
from swagger_client.models.inline_response2003 import InlineResponse2003
from swagger_client.models.inline_response2004 import InlineResponse2004
from swagger_client.models.inline_response2005 import InlineResponse2005
from swagger_client.models.inline_response2006 import InlineResponse2006
from swagger_client.models.inline_response2007 import InlineResponse2007
from swagger_client.models.inline_response2007_records import InlineResponse2007Records
from swagger_client.models.inline_response2008 import InlineResponse2008
from swagger_client.models.inline_response2008_records import InlineResponse2008Records
from swagger_client.models.inline_response2009 import InlineResponse2009
from swagger_client.models.inline_response2009_records import InlineResponse2009Records
from swagger_client.models.list_id_members_body import ListIdMembersBody
from swagger_client.models.list_id_members_body1 import ListIdMembersBody1
from swagger_client.models.list_id_subscribe_body import ListIdSubscribeBody
Expand Down
24 changes: 12 additions & 12 deletions swagger_client/api/campaigns_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def get_campaign_recipients(self, campaign_id, **kwargs): # noqa: E501
:param int count: For pagination, the number of results to return. Max = 25,000
:param str sort: Sort order to apply to results, either ascending or descending. Valid values are `asc` or `desc`. Defaults to `asc`.
:param str offset: For pagination, if a response to this endpoint includes a `next_offset`, use that value to get the next page of recipients.
:return: InlineResponse20011
:return: InlineResponse20012
If the method is called asynchronously,
returns the request thread.
"""
Expand All @@ -500,7 +500,7 @@ def get_campaign_recipients_with_http_info(self, campaign_id, **kwargs): # noqa
:param int count: For pagination, the number of results to return. Max = 25,000
:param str sort: Sort order to apply to results, either ascending or descending. Valid values are `asc` or `desc`. Defaults to `asc`.
:param str offset: For pagination, if a response to this endpoint includes a `next_offset`, use that value to get the next page of recipients.
:return: InlineResponse20011
:return: InlineResponse20012
If the method is called asynchronously,
returns the request thread.
"""
Expand Down Expand Up @@ -562,7 +562,7 @@ def get_campaign_recipients_with_http_info(self, campaign_id, **kwargs): # noqa
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse20011', # noqa: E501
response_type='InlineResponse20012', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
Expand All @@ -582,7 +582,7 @@ def get_campaigns(self, **kwargs): # noqa: E501
:param async_req bool
:param int page: For pagination, which page of results to return. Default = 0
:param int count: For pagination, the number of results to return. Max = 100
:return: InlineResponse2009
:return: InlineResponse20010
If the method is called asynchronously,
returns the request thread.
"""
Expand All @@ -605,7 +605,7 @@ def get_campaigns_with_http_info(self, **kwargs): # noqa: E501
:param async_req bool
:param int page: For pagination, which page of results to return. Default = 0
:param int count: For pagination, the number of results to return. Max = 100
:return: InlineResponse2009
:return: InlineResponse20010
If the method is called asynchronously,
returns the request thread.
"""
Expand Down Expand Up @@ -659,7 +659,7 @@ def get_campaigns_with_http_info(self, **kwargs): # noqa: E501
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse2009', # noqa: E501
response_type='InlineResponse20010', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
Expand All @@ -679,7 +679,7 @@ def schedule_campaign(self, campaign_id, **kwargs): # noqa: E501
:param async_req bool
:param str campaign_id: (required)
:param str send_time:
:return: InlineResponse20010
:return: InlineResponse20011
If the method is called asynchronously,
returns the request thread.
"""
Expand All @@ -702,7 +702,7 @@ def schedule_campaign_with_http_info(self, campaign_id, **kwargs): # noqa: E501
:param async_req bool
:param str campaign_id: (required)
:param str send_time:
:return: InlineResponse20010
:return: InlineResponse20011
If the method is called asynchronously,
returns the request thread.
"""
Expand Down Expand Up @@ -764,7 +764,7 @@ def schedule_campaign_with_http_info(self, campaign_id, **kwargs): # noqa: E501
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse20010', # noqa: E501
response_type='InlineResponse20011', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
Expand All @@ -783,7 +783,7 @@ def send_campaign(self, campaign_id, **kwargs): # noqa: E501
:param async_req bool
:param str campaign_id: (required)
:return: InlineResponse20010
:return: InlineResponse20011
If the method is called asynchronously,
returns the request thread.
"""
Expand All @@ -805,7 +805,7 @@ def send_campaign_with_http_info(self, campaign_id, **kwargs): # noqa: E501
:param async_req bool
:param str campaign_id: (required)
:return: InlineResponse20010
:return: InlineResponse20011
If the method is called asynchronously,
returns the request thread.
"""
Expand Down Expand Up @@ -861,7 +861,7 @@ def send_campaign_with_http_info(self, campaign_id, **kwargs): # noqa: E501
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='InlineResponse20010', # noqa: E501
response_type='InlineResponse20011', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
Expand Down
4 changes: 2 additions & 2 deletions swagger_client/api/data_privacy_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def __init__(self, api_client=None):
def request_deletion(self, **kwargs): # noqa: E501
"""Request a Deletion # noqa: E501
Request a data privacy-compliant deletion for the person record corresponding to an email address, phone number, or person identifier. **If multiple person records exist for the provided identifier, only one of them will be deleted.** The arguments should be sent as content type application/json. Note that only **one** identifier (email, phone_number, or person_id) can be specified. In addition to your API key, you need to set exactly one of the following parameters: `email`, `phone_number`, `or person_id`, along with the associated `string` value. Examples: Email: `{\"email\":\"abraham.lincoln@klaviyo.com\"}` Phone Number: `{\"phone_number\":\"+13239169023\"}` Person ID: `{\"person_id\":\"PERSON_ID\"}` # noqa: E501
Request a data privacy-compliant deletion for the person record corresponding to an email address, phone number, or person identifier. **If multiple person records exist for the provided identifier, only one of them will be deleted.** The arguments should be sent as content type application/json. Note that only **one** identifier (email, phone_number, or person_id) can be specified. In addition to your Private API key, you need to set exactly one of the following parameters: `email`, `phone_number`, `or person_id`, along with the associated `string` value. Examples: Email: `{\"email\":\"abraham.lincoln@klaviyo.com\"}` Phone Number: `{\"phone_number\":\"+13239169023\"}` Person ID: `{\"person_id\":\"PERSON_ID\"}` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.request_deletion(async_req=True)
Expand All @@ -58,7 +58,7 @@ def request_deletion(self, **kwargs): # noqa: E501
def request_deletion_with_http_info(self, **kwargs): # noqa: E501
"""Request a Deletion # noqa: E501
Request a data privacy-compliant deletion for the person record corresponding to an email address, phone number, or person identifier. **If multiple person records exist for the provided identifier, only one of them will be deleted.** The arguments should be sent as content type application/json. Note that only **one** identifier (email, phone_number, or person_id) can be specified. In addition to your API key, you need to set exactly one of the following parameters: `email`, `phone_number`, `or person_id`, along with the associated `string` value. Examples: Email: `{\"email\":\"abraham.lincoln@klaviyo.com\"}` Phone Number: `{\"phone_number\":\"+13239169023\"}` Person ID: `{\"person_id\":\"PERSON_ID\"}` # noqa: E501
Request a data privacy-compliant deletion for the person record corresponding to an email address, phone number, or person identifier. **If multiple person records exist for the provided identifier, only one of them will be deleted.** The arguments should be sent as content type application/json. Note that only **one** identifier (email, phone_number, or person_id) can be specified. In addition to your Private API key, you need to set exactly one of the following parameters: `email`, `phone_number`, `or person_id`, along with the associated `string` value. Examples: Email: `{\"email\":\"abraham.lincoln@klaviyo.com\"}` Phone Number: `{\"phone_number\":\"+13239169023\"}` Person ID: `{\"person_id\":\"PERSON_ID\"}` # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.request_deletion_with_http_info(async_req=True)
Expand Down
Loading

0 comments on commit 2d44596

Please sign in to comment.