From 51fb8248016ed885f53faf5fbd72811a02a88c29 Mon Sep 17 00:00:00 2001 From: sunil-lakshman <104969541+sunil-lakshman@users.noreply.github.com> Date: Fri, 29 Aug 2025 14:44:18 +0530 Subject: [PATCH] Added AWS AU and GCP EU region support --- CHANGELOG.md | 6 ++++++ contentstack/__init__.py | 2 +- contentstack/stack.py | 6 ++++++ tests/test_stack.py | 10 ++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c3dfaaf..5f529fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # CHANGELOG +## _v2.4.0_ + +### **Date: 01-September-2025** + +- AWS AU and GCP EU region support added. + ## _v2.3.0_ ### **Date: 21-July-2025** diff --git a/contentstack/__init__.py b/contentstack/__init__.py index a44eb95..6e78ad5 100644 --- a/contentstack/__init__.py +++ b/contentstack/__init__.py @@ -22,7 +22,7 @@ __title__ = 'contentstack-delivery-python' __author__ = 'contentstack' __status__ = 'debug' -__version__ = 'v2.3.0' +__version__ = 'v2.4.0' __endpoint__ = 'cdn.contentstack.io' __email__ = 'support@contentstack.com' __developer_email__ = 'mobile@contentstack.com' diff --git a/contentstack/stack.py b/contentstack/stack.py index eb3567c..8194ef4 100644 --- a/contentstack/stack.py +++ b/contentstack/stack.py @@ -20,9 +20,11 @@ class ContentstackRegion(enum.Enum): """ US = 'us' EU = 'eu' + AU = 'au' AZURE_NA = 'azure-na' AZURE_EU = 'azure-eu' GCP_NA = 'gcp-na' + GCP_EU = 'gcp-eu' class Stack: @@ -124,12 +126,16 @@ def _validate_stack(self): if self.region.value == 'eu' and self.host == DEFAULT_HOST: self.host = 'eu-cdn.contentstack.com' + elif self.region.value == 'au' and self.host == DEFAULT_HOST: + self.host = 'au-cdn.contentstack.com' elif self.region.value == 'azure-na' and self.host == DEFAULT_HOST: self.host = 'azure-na-cdn.contentstack.com' elif self.region.value == 'azure-eu' and self.host == DEFAULT_HOST: self.host = 'azure-eu-cdn.contentstack.com' elif self.region.value == 'gcp-na' and self.host == DEFAULT_HOST: self.host = 'gcp-na-cdn.contentstack.com' + elif self.region.value == 'gcp-eu' and self.host == DEFAULT_HOST: + self.host = 'gcp-eu-cdn.contentstack.com' elif self.region.value != 'us': self.host = f'{self.region.value}-{DEFAULT_HOST}' self.endpoint = f'https://{self.host}/{self.version}' diff --git a/tests/test_stack.py b/tests/test_stack.py index 886ecea..7bc052c 100644 --- a/tests/test_stack.py +++ b/tests/test_stack.py @@ -36,6 +36,16 @@ def test_02_stack_gcp_na_region(self): API_KEY, DELIVERY_TOKEN, ENVIRONMENT, region=ContentstackRegion.GCP_NA) self.assertEqual('gcp-na-cdn.contentstack.com', stack_region.host) + def test_02_stack_au_region(self): + stack_region = contentstack.Stack( + API_KEY, DELIVERY_TOKEN, ENVIRONMENT, region=ContentstackRegion.AU) + self.assertEqual('au-cdn.contentstack.com', stack_region.host) + + def test_02_stack_gcp_eu_region(self): + stack_region = contentstack.Stack( + API_KEY, DELIVERY_TOKEN, ENVIRONMENT, region=ContentstackRegion.GCP_EU) + self.assertEqual('gcp-eu-cdn.contentstack.com', stack_region.host) + def test_03_stack_endpoint(self): self.assertEqual(f"https://{config.HOST}/v3", self.stack.endpoint)