Skip to content

Commit 4e3296a

Browse files
authored
Merge pull request #11 from klaviyo/1.2.1
added fix to event paging, updated changelog
2 parents ce436b4 + 3fef1e2 commit 4e3296a

6 files changed

Lines changed: 33 additions & 24 deletions

File tree

CHANGELOG.md

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22

33
NOTE: For more granular API-specific changes, please see our [API Changelog](https://developers.klaviyo.com/en/docs/changelog_)
44

5-
## 1.0.0
5+
## 1.2.1
66

7-
* Initial release
7+
### Bug Fixes
8+
- Fixed bug that caused paging through events to periodically fail
89

9-
Differences between 1.0.0 and BETA:
10+
## 1.2.0
1011

11-
- Namespace changes
12-
- Pypi package name: `klaviyo–sdk-beta``klaviyo-api`
13-
- Module name: `klaviyo_sdk_beta``klaviyo_api`
14-
- client name: `Client``KlaviyoAPI`
15-
- Client variable name in readme examples: `client``klaviyo`
16-
- Some functions have changed name
17-
- New resources and endpoints: see [API Changelog](https://developers.klaviyo.com/en/docs/changelog_) for full details
12+
### Added
13+
- Campaigns (which were previously in our Beta API/SDKs)
14+
15+
### Changes
16+
- Flows
17+
- Pagination changed from page offset to cursor
1818

1919
## 1.1.0
2020

@@ -25,11 +25,17 @@ NOTE: For more granular API-specific changes, please see our [API Changelog](htt
2525
- Get List Tags
2626
- Get Segment Tags
2727

28-
## 1.2.0
28+
## 1.0.0
2929

30-
### Added
31-
- Campaigns (which were previously in our Beta API/SDKs)
30+
* Initial release
31+
32+
Differences between 1.0.0 and BETA:
33+
34+
- Namespace changes
35+
- Pypi package name: `klaviyo–sdk-beta``klaviyo-api`
36+
- Module name: `klaviyo_sdk_beta``klaviyo_api`
37+
- client name: `Client``KlaviyoAPI`
38+
- Client variable name in readme examples: `client``klaviyo`
39+
- Some functions have changed name
40+
- New resources and endpoints: see [API Changelog](https://developers.klaviyo.com/en/docs/changelog_) for full details
3241

33-
### Changes
34-
- Flows
35-
- Pagination changed from page offset to cursor

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Klaviyo Python SDK
22

3-
- SDK version: 1.2.0
3+
- SDK version: 1.2.1
44
- API revision: 2023-02-22
55

66
## Helpful Resources

klaviyo_api/wrapper.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
from __future__ import print_function
44
import tenacity
5+
from urllib.parse import quote, unquote
6+
57
import openapi_client
68
import klaviyo_api.custom_retry as custom_retry
79
from dataclasses import dataclass
@@ -294,7 +296,7 @@ def __post_init__(self):
294296
def _page_cursor_update(cls, func: Callable, *args, **kwargs) -> Callable:
295297
def _wrapped_func(*args, **kwargs):
296298
if 'page_cursor' in kwargs:
297-
page_cursor = kwargs['page_cursor']+'&'
299+
page_cursor = kwargs['page_cursor']
298300
if page_cursor:
299301
if isinstance(page_cursor,str):
300302
if 'https://' in page_cursor:
@@ -305,8 +307,9 @@ def _wrapped_func(*args, **kwargs):
305307
found_token = token
306308
break
307309
if found_token:
308-
start = page_cursor.find(found_token)+len(found_token)+1
309-
end = page_cursor[start:].find('&')
310-
kwargs['page_cursor'] = page_cursor[start:start+end]
310+
page_cursor=page_cursor.split(found_token)[-1]
311+
page_cursor = page_cursor.split('&')[0]
312+
page_cursor = unquote(page_cursor)
313+
kwargs['page_cursor'] = page_cursor
311314
return func(*args,**kwargs)
312315
return _wrapped_func

openapi_client/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"""
1212

1313

14-
__version__ = "1.2.0"
14+
__version__ = "1.2.1"
1515

1616
# import ApiClient
1717
from openapi_client.api_client import ApiClient

openapi_client/api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
7777
self.default_headers[header_name] = header_value
7878
self.cookie = cookie
7979
# Set default User-Agent.
80-
self.user_agent = 'klaviyo-api-python/1.2.0'
80+
self.user_agent = 'klaviyo-api-python/1.2.1'
8181

8282
def __enter__(self):
8383
return self

openapi_client/configuration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ def to_debug_report(self):
410410
"OS: {env}\n"\
411411
"Python Version: {pyversion}\n"\
412412
"Version of the API: 2023-02-22\n"\
413-
"SDK Package Version: 1.2.0".\
413+
"SDK Package Version: 1.2.1".\
414414
format(env=sys.platform, pyversion=sys.version)
415415

416416
def get_host_settings(self):

0 commit comments

Comments
 (0)