Skip to content

Commit 5ce64de

Browse files
Merge pull request #54 from contentstack/next
Next
2 parents f25d5ca + fc124f5 commit 5ce64de

12 files changed

+89
-195
lines changed

.github/workflows/sast-scan.yml

-11
This file was deleted.

.github/workflows/sca-scan.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
steps:
99
- uses: actions/checkout@master
1010
- name: Run Snyk to check for vulnerabilities
11-
uses: snyk/actions/python@master
11+
uses: snyk/actions/python-3.10@master
1212
env:
1313
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
1414
with:

.github/workflows/secrets-scan.yml

-11
This file was deleted.

CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# CHANGELOG
22

3+
## _v1.8.1_
4+
5+
### **Date: 06-NOVEMBER-2023**
6+
7+
- SNYK issues fixed
8+
- General code improvement clean up
9+
10+
---
11+
312
## _v1.8.0_
413

514
### **Date: 26-MAY-2023**

README.rst

-144
This file was deleted.

changelog.rst

+9
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
**CHANGELOG**
33
================
44

5+
*v1.8.1*
6+
============
7+
8+
**Date: 06-NOVEMBER-2023**
9+
10+
- SNYK issues fixed
11+
- General code improvement clean up
12+
13+
514
*v1.8.0*
615
============
716

contentstack/__init__.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,20 @@
1010
from contentstack.stack import Stack
1111
from .utility import Utils
1212

13-
__title__ = 'contentstack-python'
13+
__all__ = (
14+
"Entry",
15+
"Asset",
16+
"ContentType",
17+
"HTTPSConnection",
18+
"Stack",
19+
"Utils"
20+
)
21+
22+
__title__ = 'contentstack-delivery-python'
1423
__author__ = 'contentstack'
1524
__status__ = 'debug'
16-
__version__ = 'v1.8.0'
25+
__version__ = 'v1.8.1'
1726
__endpoint__ = 'cdn.contentstack.io'
1827
__email__ = '[email protected]'
1928
__developer_email__ = '[email protected]'
29+
__license__ = "MIT"

contentstack/stack.py

+12-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
from contentstack.https_connection import HTTPSConnection
1010
from contentstack.image_transform import ImageTransform
1111

12-
__author__ = "ishaileshmishra ([email protected])"
13-
__license__ = "MIT"
14-
__version__ = '1.8.0'
15-
1612
log = logging.getLogger(__name__)
1713
DEFAULT_HOST = 'cdn.contentstack.io'
1814

@@ -44,6 +40,7 @@ def __init__(self, api_key: str, delivery_token: str, environment: str,
4440
total=5, backoff_factor=0, status_forcelist=[408, 429]),
4541
live_preview=None,
4642
branch=None,
43+
early_access = None,
4744
):
4845
"""
4946
# Class that wraps the credentials of the authenticated user. Think of
@@ -96,6 +93,7 @@ def __init__(self, api_key: str, delivery_token: str, environment: str,
9693
self.branch = branch
9794
self.retry_strategy = retry_strategy
9895
self.live_preview = live_preview
96+
self.early_access = early_access
9997
self._validate_stack()
10098

10199
def _validate_stack(self):
@@ -127,6 +125,9 @@ def _validate_stack(self):
127125
'access_token': self.delivery_token,
128126
'environment': self.environment
129127
}
128+
if self.early_access is not None:
129+
early_access_str = ', '.join(self.early_access)
130+
self.headers['x-header-ea'] = early_access_str
130131

131132
if self.branch is not None:
132133
self.headers['branch'] = self.branch
@@ -145,6 +146,13 @@ def get_api_key(self):
145146
:return: api_key of the stack
146147
"""
147148
return self.api_key
149+
150+
@property
151+
def get_early_access(self):
152+
"""
153+
:return: early access
154+
"""
155+
return self.early_access
148156

149157
@property
150158
def get_delivery_token(self):

requirements.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ tox==4.5.1
88
virtualenv==20.23.0
99
Sphinx==7.0.1
1010
sphinxcontrib-websupport==1.2.4
11-
pip==23.1.2
11+
pip==23.3.1
1212
build==0.10.0
1313
wheel==0.40.0
1414
lxml==4.9.2
@@ -33,7 +33,7 @@ pytz==2023.3
3333
Babel==2.12.1
3434
pep517==0.13.0
3535
tomli~=2.0.1
36-
Werkzeug==2.3.4
36+
Werkzeug==3.0.1
3737
Flask~=2.3.2
3838
click~=8.1.3
3939
MarkupSafe==2.1.2
@@ -49,7 +49,7 @@ imagesize==1.4.1
4949
snowballstemmer~=2.2.0
5050
Pygments~=2.15.1
5151
wrapt==1.15.0
52-
certifi==2023.5.7
52+
certifi==2023.7.22
5353
oauthlib==3.2.2
5454
idna==3.4
5555
chardet~=5.1.0
@@ -59,6 +59,6 @@ distlib~=0.3.6
5959
Empty~=0.4.4
6060
cachetools~=5.3.0
6161
tomlkit~=0.11.8
62-
urllib3==2.0.2
62+
urllib3==2.0.7
6363
exceptiongroup~=1.1.1
6464
iniconfig~=2.0.0

setup.py

+16-3
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,25 @@
44
# as the name and version) as well as which code files to include
55

66
import os
7+
import re
8+
import sys
79

810
try:
9-
from setuptools import setup
11+
from setuptools import setup, find_packages
1012
except ImportError:
1113
from distutils.core import setup
1214

15+
package = "contentstack"
16+
17+
def get_version(package):
18+
"""
19+
Return package version as listed in `__version__` in `init.py`.
20+
"""
21+
init_py = open(os.path.join(package, '__init__.py')).read()
22+
return re.search("^__version__ = ['\"]([^'\"]+)['\"]",
23+
init_py, re.MULTILINE).group(1)
24+
25+
1326
with open(os.path.join(os.path.dirname(__file__), 'README.md')) as readme:
1427
long_description = readme.read()
1528

@@ -25,9 +38,9 @@
2538
type="process",
2639
created="09 Jun 2020",
2740
keywords="contentstack-python",
28-
version="1.8.0",
41+
version=get_version(package),
2942
author="Contentstack",
30-
author_email="[email protected]",
43+
3144
description="Contentstack is a headless CMS with an API-first approach.",
3245
long_description=long_description,
3346
long_description_content_type="text/markdown",

tests/test_assets.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ def setUp(self):
2323
def test_011_setting_timeout(self):
2424
excepted = 13 # setting a custom timeout
2525
self.stack = contentstack.Stack(
26-
API_KEY, DELIVERY_TOKEN, ENVIRONMENT, host=config.host, timeout=excepted)
26+
API_KEY, DELIVERY_TOKEN, ENVIRONMENT, host=config.HOST, timeout=excepted)
2727
self.assertEqual(excepted, self.stack.timeout)
2828

2929
def test_12_setting_timeout_failure(self):
3030
try:
3131
excepted = 1.00 # setting a custom timeout
3232
self.stack = contentstack.Stack(
33-
API_KEY, DELIVERY_TOKEN, ENVIRONMENT, host=config.host, timeout=excepted)
33+
API_KEY, DELIVERY_TOKEN, ENVIRONMENT, host=config.HOST, timeout=excepted)
3434
self.stack.asset_query().find()
3535
except TimeoutError:
3636
self.assertEqual('Timeout expired.', TimeoutError.__doc__)

0 commit comments

Comments
 (0)