Contentstack 1.8.2__tar.gz → 1.10.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. {Contentstack-1.8.2 → contentstack-1.10.0}/Contentstack.egg-info/PKG-INFO +1 -1
  2. {Contentstack-1.8.2 → contentstack-1.10.0}/LICENSE +1 -1
  3. {Contentstack-1.8.2 → contentstack-1.10.0}/PKG-INFO +1 -1
  4. {Contentstack-1.8.2 → contentstack-1.10.0}/contentstack/__init__.py +1 -1
  5. {Contentstack-1.8.2 → contentstack-1.10.0}/contentstack/assetquery.py +1 -1
  6. {Contentstack-1.8.2 → contentstack-1.10.0}/contentstack/stack.py +3 -0
  7. {Contentstack-1.8.2 → contentstack-1.10.0}/contentstack/utility.py +17 -9
  8. {Contentstack-1.8.2 → contentstack-1.10.0}/tests/test_stack.py +5 -0
  9. {Contentstack-1.8.2 → contentstack-1.10.0}/Contentstack.egg-info/SOURCES.txt +0 -0
  10. {Contentstack-1.8.2 → contentstack-1.10.0}/Contentstack.egg-info/dependency_links.txt +0 -0
  11. {Contentstack-1.8.2 → contentstack-1.10.0}/Contentstack.egg-info/not-zip-safe +0 -0
  12. {Contentstack-1.8.2 → contentstack-1.10.0}/Contentstack.egg-info/requires.txt +0 -0
  13. {Contentstack-1.8.2 → contentstack-1.10.0}/Contentstack.egg-info/top_level.txt +0 -0
  14. {Contentstack-1.8.2 → contentstack-1.10.0}/README.md +0 -0
  15. {Contentstack-1.8.2 → contentstack-1.10.0}/contentstack/asset.py +0 -0
  16. {Contentstack-1.8.2 → contentstack-1.10.0}/contentstack/basequery.py +0 -0
  17. {Contentstack-1.8.2 → contentstack-1.10.0}/contentstack/contenttype.py +0 -0
  18. {Contentstack-1.8.2 → contentstack-1.10.0}/contentstack/controller.py +0 -0
  19. {Contentstack-1.8.2 → contentstack-1.10.0}/contentstack/deep_merge_lp.py +0 -0
  20. {Contentstack-1.8.2 → contentstack-1.10.0}/contentstack/entry.py +0 -0
  21. {Contentstack-1.8.2 → contentstack-1.10.0}/contentstack/entryqueryable.py +0 -0
  22. {Contentstack-1.8.2 → contentstack-1.10.0}/contentstack/https_connection.py +0 -0
  23. {Contentstack-1.8.2 → contentstack-1.10.0}/contentstack/image_transform.py +0 -0
  24. {Contentstack-1.8.2 → contentstack-1.10.0}/contentstack/query.py +0 -0
  25. {Contentstack-1.8.2 → contentstack-1.10.0}/setup.cfg +0 -0
  26. {Contentstack-1.8.2 → contentstack-1.10.0}/setup.py +0 -0
  27. {Contentstack-1.8.2 → contentstack-1.10.0}/tests/test_assets.py +0 -0
  28. {Contentstack-1.8.2 → contentstack-1.10.0}/tests/test_entry.py +0 -0
  29. {Contentstack-1.8.2 → contentstack-1.10.0}/tests/test_live_preview.py +0 -0
  30. {Contentstack-1.8.2 → contentstack-1.10.0}/tests/test_query.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Contentstack
3
- Version: 1.8.2
3
+ Version: 1.10.0
4
4
  Summary: Contentstack is a headless CMS with an API-first approach.
5
5
  Home-page: https://github.com/contentstack/contentstack-python
6
6
  Author: Contentstack
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2012 - 2023 Contentstack. All rights reserved.
3
+ Copyright (c) 2012 - 2024 Contentstack. All rights reserved.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Contentstack
3
- Version: 1.8.2
3
+ Version: 1.10.0
4
4
  Summary: Contentstack is a headless CMS with an API-first approach.
5
5
  Home-page: https://github.com/contentstack/contentstack-python
6
6
  Author: Contentstack
@@ -22,7 +22,7 @@ __all__ = (
22
22
  __title__ = 'contentstack-delivery-python'
23
23
  __author__ = 'contentstack'
24
24
  __status__ = 'debug'
25
- __version__ = 'v1.8.2'
25
+ __version__ = 'v1.10.0'
26
26
  __endpoint__ = 'cdn.contentstack.io'
27
27
  __email__ = 'mobile@contentstack.com'
28
28
  __developer_email__ = 'shailesh.mishra@contentstack.com'
@@ -176,6 +176,6 @@ class AssetQuery(BaseQuery):
176
176
 
177
177
  """
178
178
  if self.parameters is not None and len(self.parameters) > 0:
179
- self.asset_query_params["query"] = json.dumps(self.parameters)
179
+ self.asset_query_params["query"] = self.parameters
180
180
  url = Utils.get_complete_url(self.base_url, self.asset_query_params)
181
181
  return self.http_instance.get(url)
@@ -21,6 +21,7 @@ class ContentstackRegion(enum.Enum):
21
21
  EU = 'eu'
22
22
  AZURE_NA = 'azure-na'
23
23
  AZURE_EU = 'azure-eu'
24
+ GCP_NA = 'gcp-na'
24
25
 
25
26
 
26
27
  class Stack:
@@ -116,6 +117,8 @@ class Stack:
116
117
  self.host = 'azure-na-cdn.contentstack.com'
117
118
  elif self.region.value == 'azure-eu' and self.host == DEFAULT_HOST:
118
119
  self.host = 'azure-eu-cdn.contentstack.com'
120
+ elif self.region.value == 'gcp-na' and self.host == DEFAULT_HOST:
121
+ self.host = 'gcp-na-cdn.contentstack.com'
119
122
  elif self.region.value != 'us':
120
123
  self.host = f'{self.region.value}-{DEFAULT_HOST}'
121
124
  self.endpoint = f'https://{self.host}/{self.version}'
@@ -5,7 +5,7 @@ Copyright 2019 Contentstack. All rights reserved.
5
5
 
6
6
  import json
7
7
  import logging
8
- from urllib import parse
8
+ from urllib.parse import urlencode, urljoin
9
9
 
10
10
  log = logging.getLogger(__name__)
11
11
 
@@ -55,14 +55,22 @@ class Utils:
55
55
  return parse.urlencode(params)
56
56
 
57
57
  @staticmethod
58
- def get_complete_url(base_url: str, params: dict):
58
+ def get_complete_url(base_url: str, params: dict) -> str:
59
59
  """
60
- creates complete url using base_url and their respective parameters
61
- :param base_url:
62
- :param params:
63
- :return:
60
+ Creates a complete URL using base_url and their respective parameters.
61
+ :param base_url: The base URL to which parameters are appended.
62
+ :param params: A dictionary of parameters to be included in the URL.
63
+ :return: A complete URL with encoded parameters.
64
64
  """
65
+ # Ensure 'query' is properly serialized as a JSON string without extra quotes
65
66
  if 'query' in params:
66
- params["query"] = json.dumps(params["query"])
67
- query = parse.urlencode(params)
68
- return f'{base_url}&{query}'
67
+ params["query"] = json.dumps(params["query"], separators=(',', ':'))
68
+
69
+ # Encode parameters
70
+ query_string = urlencode(params, doseq=True)
71
+
72
+ # Join base_url and query_string
73
+ if '?' in base_url:
74
+ return f'{base_url}&{query_string}'
75
+ else:
76
+ return f'{base_url}?{query_string}'
@@ -28,6 +28,11 @@ class TestStack(unittest.TestCase):
28
28
  API_KEY, DELIVERY_TOKEN, ENVIRONMENT, region=ContentstackRegion.EU)
29
29
  self.assertEqual('eu-cdn.contentstack.com', stack_region.host)
30
30
 
31
+ def test_02_stack_gcp_na_region(self):
32
+ stack_region = contentstack.Stack(
33
+ API_KEY, DELIVERY_TOKEN, ENVIRONMENT, region=ContentstackRegion.GCP_NA)
34
+ self.assertEqual('gcp-na-cdn.contentstack.com', stack_region.host)
35
+
31
36
  def test_03_stack_endpoint(self):
32
37
  self.assertEqual(f"https://{config.HOST}/v3",
33
38
  self.stack.endpoint)
File without changes
File without changes
File without changes