Skip to content

Commit fe515f9

Browse files
azure-na support v1.7.0
1 parent d8ee809 commit fe515f9

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

contentstack/stack.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
__author__ = "ishaileshmishra (ishaileshmishra@gmail.com)"
2323
__license__ = "MIT"
24-
__version__ = '1.6.0'
24+
__version__ = '1.7.0'
2525

2626
log = logging.getLogger(__name__)
2727

@@ -44,10 +44,10 @@ class Stack:
4444
together to create, edit, approve, and publish content.
4545
(API Reference)[https://www.contentstack.com/docs/developers/apis/content-delivery-api/#stack]:
4646
"""
47-
host_name = cdn.contentstack.io
47+
default_host = cdn.contentstack.io
4848

4949
def __init__(self, api_key: str, delivery_token: str, environment: str,
50-
host=host_name,
50+
host=default_host,
5151
version='v3',
5252
region=ContentstackRegion.US,
5353
timeout=30,
@@ -122,14 +122,13 @@ def _validate_stack(self):
122122
'You are not permitted to the stack without valid Environment')
123123

124124
# prepare endpoint for the url:
125-
if self.region.value == 'eu':
125+
if self.region.value == 'eu' and self.host == default_host:
126126
self.host = 'eu-cdn.contentstack.com'
127-
if self.host == 'cdn.contentstack.io':
128-
self.host = 'eu-cdn.contentstack.com'
129-
if self.region.value == 'azure-na':
127+
elif self.region.value == 'azure-na' and self.host == default_host:
130128
self.host = 'azure-na-cdn.contentstack.com'
131-
if self.host == 'cdn.contentstack.io':
132-
self.host = 'azure-na-cdn.contentstack.com'
129+
elif self.region.value != 'us':
130+
self.host = '{}-{}'.format(self.region.value, default_host)
131+
133132
self.endpoint = 'https://{}/{}'.format(self.host, self.version)
134133
# prepare Headers:`
135134

0 commit comments

Comments
 (0)