2121
2222__author__ = "ishaileshmishra (ishaileshmishra@gmail.com)"
2323__license__ = "MIT"
24- __version__ = '1.6 .0'
24+ __version__ = '1.7 .0'
2525
2626log = 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