Skip to content
Merged
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Content Management SDK For Python
---
## v1.3.0

#### Date: 04 September 2024

- Added Early access support.
---

## v1.2.0

Expand Down
2 changes: 1 addition & 1 deletion contentstack_management/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
__author__ = 'ishaileshmishra'
__status__ = 'debug'
__region__ = 'na'
__version__ = '1.2.0'
__version__ = '1.3.0'
__host__ = 'api.contentstack.io'
__protocol__ = 'https://'
__api_version__ = 'v3'
Expand Down
6 changes: 5 additions & 1 deletion contentstack_management/contentstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Client:
# TODO: DefaultCSCredential(), needs to be implemented
def __init__(self, host: str = 'api.contentstack.io', scheme: str = 'https://',
authtoken: str = None , management_token=None, headers: dict = None,
region: Region = Region.US.value, version='v3', timeout=2, max_retries: int = 18,
region: Region = Region.US.value, version='v3', timeout=2, max_retries: int = 18, early_access: list = None,
**kwargs):
self.endpoint = 'https://api.contentstack.io/v3/'
if region is not None and host is not None and region is not Region.US.value:
Expand All @@ -43,6 +43,10 @@ def __init__(self, host: str = 'api.contentstack.io', scheme: str = 'https://',
self.endpoint = f'{scheme}{host}/{version}/'
if headers is None:
headers = {}
if early_access is not None:
early_access_str = ', '.join(self.early_access)
headers['x-header-ea'] = early_access_str

if authtoken is not None:
headers['authtoken'] = authtoken

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
python-dotenv~=1.0.0
setuptools==68.0.0
setuptools==70.0.0
requests~=2.32.0
pylint
bson>=0.5.9
Expand Down
5 changes: 4 additions & 1 deletion tests/test_contentstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ def test_error_password(self):
self.assertEqual(
"'You are not permitted to the stack without valid password'", e.args[0])


def test_earlyaccess(self):
client = contentstack_management.Client(host=host, early_access=['ea1','ea2'])
response = client.login(username, password)
self.assertEqual(response.request.headers["x-header-ea"], "ea1, ea2")


if __name__ == '__main__':
Expand Down