Skip to content

Commit 9067d92

Browse files
authored
Merge pull request #65 from contentstack/next
Added Early access support feature
2 parents f33c316 + f448a88 commit 9067d92

File tree

5 files changed

+17
-4
lines changed

5 files changed

+17
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
## Content Management SDK For Python
44
---
5+
## v1.3.0
6+
7+
#### Date: 04 September 2024
8+
9+
- Added Early access support.
10+
---
511

612
## v1.2.0
713

contentstack_management/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
__author__ = 'ishaileshmishra'
7373
__status__ = 'debug'
7474
__region__ = 'na'
75-
__version__ = '1.2.0'
75+
__version__ = '1.3.0'
7676
__host__ = 'api.contentstack.io'
7777
__protocol__ = 'https://'
7878
__api_version__ = 'v3'

contentstack_management/contentstack.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Client:
3131
# TODO: DefaultCSCredential(), needs to be implemented
3232
def __init__(self, host: str = 'api.contentstack.io', scheme: str = 'https://',
3333
authtoken: str = None , management_token=None, headers: dict = None,
34-
region: Region = Region.US.value, version='v3', timeout=2, max_retries: int = 18,
34+
region: Region = Region.US.value, version='v3', timeout=2, max_retries: int = 18, early_access: list = None,
3535
**kwargs):
3636
self.endpoint = 'https://api.contentstack.io/v3/'
3737
if region is not None and host is not None and region is not Region.US.value:
@@ -43,6 +43,10 @@ def __init__(self, host: str = 'api.contentstack.io', scheme: str = 'https://',
4343
self.endpoint = f'{scheme}{host}/{version}/'
4444
if headers is None:
4545
headers = {}
46+
if early_access is not None:
47+
early_access_str = ', '.join(self.early_access)
48+
headers['x-header-ea'] = early_access_str
49+
4650
if authtoken is not None:
4751
headers['authtoken'] = authtoken
4852

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
python-dotenv~=1.0.0
2-
setuptools==68.0.0
2+
setuptools==70.0.0
33
requests~=2.32.0
44
pylint
55
bson>=0.5.9

tests/test_contentstack.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ def test_error_password(self):
5050
self.assertEqual(
5151
"'You are not permitted to the stack without valid password'", e.args[0])
5252

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

5558

5659
if __name__ == '__main__':

0 commit comments

Comments
 (0)