contentstack-management 1.7.0__tar.gz → 1.7.2__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 (81) hide show
  1. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/LICENSE +1 -1
  2. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/PKG-INFO +2 -2
  3. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/README.md +1 -1
  4. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/__init__.py +1 -1
  5. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/_api_client.py +2 -0
  6. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/_constant.py +3 -2
  7. contentstack_management-1.7.2/contentstack_management/_messages.py +131 -0
  8. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/aliases/aliases.py +2 -1
  9. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/assets/assets.py +11 -10
  10. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/auditlogs/auditlog.py +2 -1
  11. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/branches/branches.py +3 -2
  12. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/bulk_operations/bulk_operation.py +2 -1
  13. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/content_types/content_type.py +3 -2
  14. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/contentstack.py +2 -1
  15. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/delivery_token/delivery_token.py +2 -1
  16. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/entries/entry.py +19 -18
  17. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/entry_variants/entry_variants.py +4 -3
  18. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/environments/environment.py +2 -1
  19. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/extensions/extension.py +2 -1
  20. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/global_fields/global_fields.py +2 -1
  21. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/labels/label.py +2 -1
  22. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/locale/locale.py +2 -1
  23. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/management_token/management_token.py +2 -1
  24. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/metadata/metadata.py +2 -1
  25. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/oauth/oauth_handler.py +30 -22
  26. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/oauth/oauth_interceptor.py +8 -6
  27. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/organizations/organization.py +7 -6
  28. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/publish_queue/publish_queue.py +2 -1
  29. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/release_items/release_item.py +2 -1
  30. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/releases/release.py +3 -2
  31. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/roles/roles.py +2 -1
  32. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/stack/stack.py +11 -10
  33. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/taxonomies/taxonomy.py +2 -1
  34. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/terms/terms.py +4 -3
  35. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/user_session/user_session.py +3 -2
  36. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/variant_group/variant_group.py +2 -1
  37. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/variants/variants.py +4 -3
  38. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/webhooks/webhook.py +9 -8
  39. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/workflows/workflows.py +14 -13
  40. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management.egg-info/PKG-INFO +2 -2
  41. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management.egg-info/SOURCES.txt +1 -0
  42. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/_errors.py +0 -0
  43. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/aliases/__init__.py +0 -0
  44. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/assets/__init__.py +0 -0
  45. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/auditlogs/__init__.py +0 -0
  46. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/branches/__init__.py +0 -0
  47. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/bulk_operations/__init__.py +0 -0
  48. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/common.py +0 -0
  49. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/content_types/__init__.py +0 -0
  50. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/delivery_token/__init__.py +0 -0
  51. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/entries/__init__.py +0 -0
  52. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/entry_variants/__init__.py +0 -0
  53. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/environments/__init__.py +0 -0
  54. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/extensions/__init__.py +0 -0
  55. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/global_fields/__init__.py +0 -0
  56. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/labels/__init__.py +0 -0
  57. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/locale/__init__.py +0 -0
  58. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/management_token/__init__.py +0 -0
  59. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/metadata/__init__.py +0 -0
  60. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/oauth/__init__.py +0 -0
  61. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/organizations/__init__.py +0 -0
  62. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/publish_queue/__init__.py +0 -0
  63. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/release_items/__init__.py +0 -0
  64. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/releases/__init__.py +0 -0
  65. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/roles/__init__.py +0 -0
  66. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/stack/__init__.py +0 -0
  67. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/taxonomies/__init__.py +0 -0
  68. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/terms/__init__.py +0 -0
  69. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/user_session/__init__.py +0 -0
  70. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/users/__init__.py +0 -0
  71. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/users/user.py +0 -0
  72. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/variant_group/__init__.py +0 -0
  73. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/variants/__init__.py +0 -0
  74. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/webhooks/__init__.py +0 -0
  75. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management/workflows/__init__.py +0 -0
  76. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management.egg-info/dependency_links.txt +0 -0
  77. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management.egg-info/requires.txt +0 -0
  78. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/contentstack_management.egg-info/top_level.txt +0 -0
  79. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/setup.cfg +0 -0
  80. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/setup.py +0 -0
  81. {contentstack_management-1.7.0 → contentstack_management-1.7.2}/tests/test_contentstack.py +0 -0
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2012 - 2025 Contentstack. All rights reserved.
3
+ Copyright (c) 2012 - 2026 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.4
2
2
  Name: contentstack-management
3
- Version: 1.7.0
3
+ Version: 1.7.2
4
4
  Summary: Contentstack API Client Library for Python
5
5
  Home-page: https://github.com/contentstack/contentstack-management-python
6
6
  Author: dev-ex
@@ -157,7 +157,7 @@ chmod +x .git/hooks/pre-commit .git/hooks/pre-push
157
157
  - [Content Management API Docs](https://www.contentstack.com/docs/developers/apis/content-management-api)
158
158
 
159
159
  ### The MIT License (MIT)
160
- Copyright © 2012-2025 [Contentstack](https://www.contentstack.com/). All Rights Reserved
160
+ Copyright © 2012-2026 [Contentstack](https://www.contentstack.com/). All Rights Reserved
161
161
 
162
162
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
163
163
 
@@ -123,7 +123,7 @@ chmod +x .git/hooks/pre-commit .git/hooks/pre-push
123
123
  - [Content Management API Docs](https://www.contentstack.com/docs/developers/apis/content-management-api)
124
124
 
125
125
  ### The MIT License (MIT)
126
- Copyright © 2012-2025 [Contentstack](https://www.contentstack.com/). All Rights Reserved
126
+ Copyright © 2012-2026 [Contentstack](https://www.contentstack.com/). All Rights Reserved
127
127
 
128
128
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
129
129
 
@@ -82,7 +82,7 @@ __title__ = 'contentstack-management-python'
82
82
  __author__ = 'dev-ex'
83
83
  __status__ = 'debug'
84
84
  __region__ = 'na'
85
- __version__ = '1.7.0'
85
+ __version__ = '1.7.2'
86
86
  __host__ = 'api.contentstack.io'
87
87
  __protocol__ = 'https://'
88
88
  __api_version__ = 'v3'
@@ -63,6 +63,8 @@ class _APIClient:
63
63
  if headers is None:
64
64
  headers = {}
65
65
  headers.update(self.headers) # Merge client headers (including authtoken) with request headers
66
+ if method == 'DELETE' and '/releases' in url and data is None and json_data is None:
67
+ headers = {k: v for k, v in headers.items() if k.lower() != 'content-type'}
66
68
  response = requests.request(
67
69
  method, url, headers=headers, params=params, data=data, json=json_data, files=files, timeout=self.timeout)
68
70
  # response.raise_for_status()
@@ -1,5 +1,6 @@
1
1
  import platform
2
- import sys
2
+ import sys
3
+ from ._messages import REQUEST_HEADERS_INVALID
3
4
 
4
5
 
5
6
  def _default_user_agent():
@@ -55,4 +56,4 @@ def _request_headers():
55
56
 
56
57
 
57
58
  if __name__ == '__main__':
58
- print(_request_headers().__str__())
59
+ print(REQUEST_HEADERS_INVALID)
@@ -0,0 +1,131 @@
1
+ """
2
+ Centralized error and UI messages for Contentstack Management SDK.
3
+
4
+ This module contains all user-facing messages used throughout the SDK
5
+ to ensure consistency and easy maintenance.
6
+ """
7
+
8
+ # General messages
9
+ REQUEST_HEADERS_INVALID = "Request headers are invalid. Provide valid headers and try again."
10
+
11
+ # Alias messages
12
+ ALIAS_UID_REQUIRED = "Alias UID is required. Provide a valid Alias UID and try again."
13
+
14
+ # Asset messages
15
+ ASSET_UID_REQUIRED = "Asset UID is required. Provide a valid Asset UID and try again."
16
+ ASSET_TYPE_REQUIRED = "Asset Type is required. Provide a valid Asset Type and try again."
17
+ ASSET_VERSION_NUMBER_REQUIRED = "Version Number is required. Provide a valid Version Number and try again."
18
+
19
+ # Audit log messages
20
+ LOG_ITEM_UID_REQUIRED = "Log Item UID is required. Provide a valid Log Item UID and try again."
21
+
22
+ # Branch messages
23
+ BRANCH_UID_REQUIRED = "Branch UID is required. Provide a valid Branch UID and try again."
24
+
25
+ # Bulk operation messages
26
+ JOB_UID_REQUIRED = "Job UID is required. Provide a valid Job UID and try again."
27
+
28
+ # Content type messages
29
+ CONTENT_TYPE_UID_REQUIRED = "Content Type UID is required. Provide a valid Content Type UID and try again."
30
+
31
+ # Delivery token messages
32
+ DELIVERY_TOKEN_UID_REQUIRED = "Delivery Token UID is required. Provide a valid Delivery Token UID and try again."
33
+
34
+ # Entry messages
35
+ ENTRY_UID_REQUIRED = "Entry UID is required. Provide a valid Entry UID and try again."
36
+ ENTRY_VERSION_NUMBER_REQUIRED = "Version Number is required. Provide a valid Version Number and try again."
37
+ ENTRY_BODY_REQUIRED = "Body is required. Provide a valid Body value and try again."
38
+ ENTRY_FILE_PATH_REQUIRED = "File Path is required. Provide a valid File Path and try again."
39
+
40
+ # Entry variant messages
41
+ ENTRY_VARIANT_CONTENT_TYPE_UID_REQUIRED = "Content Type UID is required. Provide a valid Content Type UID and try again."
42
+ ENTRY_VARIANT_ENTRY_UID_REQUIRED = "Entry UID is required. Provide a valid Entry UID and try again."
43
+ ENTRY_VARIANT_UID_REQUIRED = "Variant UID is required. Provide a valid Variant UID and try again."
44
+
45
+ # Environment messages
46
+ ENVIRONMENT_UID_REQUIRED = "Environment UID is required. Provide a valid Environment UID and try again."
47
+
48
+ # Extension messages
49
+ EXTENSION_UID_REQUIRED = "Extension UID is required. Provide a valid Extension UID and try again."
50
+
51
+ # Global field messages
52
+ GLOBAL_FIELD_UID_REQUIRED = "Global Field UID is required. Provide a valid Global Field UID and try again."
53
+
54
+ # Label messages
55
+ LABEL_UID_REQUIRED = "Label UID is required. Provide a valid Label UID and try again."
56
+
57
+ # Locale messages
58
+ LOCALE_CODE_REQUIRED = "Locale Code is required. Provide a valid Locale Code and try again."
59
+
60
+ # Management token messages
61
+ MANAGEMENT_TOKEN_UID_REQUIRED = "Management Token UID is required. Provide a valid Management Token UID and try again."
62
+
63
+ # Metadata messages
64
+ METADATA_UID_REQUIRED = "Metadata UID is required. Provide a valid Metadata UID and try again."
65
+
66
+ # OAuth messages
67
+ OAUTH_ACCESS_TOKEN_EXPIRED = "Access token expired. Refreshing the token."
68
+ OAUTH_ACCESS_TOKEN_NOT_AVAILABLE = "Access token is not available. Authenticate to continue."
69
+ OAUTH_TOKENS_NOT_AVAILABLE = "OAuth tokens are not available. Please authenticate first."
70
+ OAUTH_REFRESH_TOKEN_NOT_AVAILABLE = "Refresh token is not available. Please authenticate to get a new token."
71
+ OAUTH_NOT_CONFIGURED = "OAuth is not configured. Set up OAuth to continue."
72
+ OAUTH_AUTHORIZATION_CODE_NOT_FOUND = "Authorization code was not found in the redirect URL. Provide a valid code and try again."
73
+ OAUTH_TOKEN_EXCHANGE_FAILED = "Token exchange failed. Please try authenticating again."
74
+ OAUTH_TOKEN_REFRESH_FAILED = "Token refresh failed due to {error}. Review the error and try again."
75
+ OAUTH_BASE_URL_NOT_SET = "OAuth Base URL is not set. Provide a valid OAuth Base URL and try again."
76
+ OAUTH_AUTHORIZING = "Authorizing using app ID {app_id} and client ID {client_id}."
77
+ OAUTH_AUTHORIZATION_URL_GENERATED = "OAuth handler generated the final authorization URL at {final_url}."
78
+ OAUTH_AUTHORIZATION_URL_GENERATION_FAILED = "Authorization URL generation failed due to {error}. Review the error and try again."
79
+ OAUTH_AUTHORIZATION_CODE_EMPTY = "Authorization code is required. Provide a valid code and try again."
80
+ OAUTH_TOKEN_EXCHANGE_ERROR = "Token exchange failed due to {error}. Review the error and try again."
81
+ OAUTH_TOKEN_REFRESH_ERROR = "Token refresh failed due to {error}. Review the error and try again."
82
+ OAUTH_TOKEN_REFRESH_FAILED_AFTER_401 = "Token refresh failed after a 401 response due to {error}. Review the error and try again."
83
+ OAUTH_VISIT_URL_TO_AUTHORIZE = "Visit {auth_url} to authorize."
84
+
85
+ # Organization messages
86
+ ORGANIZATION_UID_REQUIRED = "Organization UID is required. Provide a valid Organization UID and try again."
87
+
88
+ # Publish queue messages
89
+ PUBLISH_QUEUE_UID_REQUIRED = "Publish Queue UID is required. Provide a valid Publish Queue UID and try again."
90
+
91
+ # Release messages
92
+ RELEASE_UID_REQUIRED = "Release UID is required. Provide a valid Release UID and try again."
93
+
94
+ # Role messages
95
+ ROLE_UID_REQUIRED = "Role UID is required. Provide a valid Release UID and try again."
96
+
97
+ # Stack messages
98
+ API_KEY_REQUIRED = "API Key is required. Provide a valid API Key and try again."
99
+ USER_ID_REQUIRED = "User ID is required. Provide a valid User ID and try again."
100
+ OWNERSHIP_TOKEN_REQUIRED = "Ownership Token is required. Provide a valid Ownership Token and try again."
101
+
102
+ # Taxonomy messages
103
+ TAXONOMY_UID_REQUIRED = "Taxonomy UID is required. Provide a valid Taxonomy UID and try again."
104
+
105
+ # Terms messages
106
+ TERMS_UID_REQUIRED = "Terms UID is required. Provide a valid Terms UID and try again."
107
+ TERM_STRING_REQUIRED = "Term String is required. Provide a valid Term String and try again."
108
+
109
+ # User session messages
110
+ EMAIL_ID_REQUIRED = "Email ID is required. Provide a valid Email ID and try again."
111
+ PASSWORD_REQUIRED = "Password is required. Provide a valid Password and try again."
112
+
113
+ # Variant group messages
114
+ VARIANT_GROUP_UID_REQUIRED = "Variant Group UID is required. Provide a valid Variant Group UID and try again."
115
+
116
+ # Variant messages
117
+ VARIANT_UIDS_NON_EMPTY_LIST_REQUIRED = "Variant UIDs must be a non-empty list. Provide at least one Variant UID and try again."
118
+ VARIANT_UID_REQUIRED = "Variant UID is required. Provide a valid Variant UID and try again."
119
+
120
+ # Webhook messages
121
+ WEBHOOK_UID_REQUIRED = "Webhook UID is required. Provide a valid Webhook UID and try again."
122
+ WEBHOOK_FILE_PATH_REQUIRED = "File Path is required. Provide a valid File Path and try again."
123
+ WEBHOOK_EXECUTION_UID_REQUIRED = "Execution UID is required. Provide a valid Execution UID and try again."
124
+
125
+ # Workflow messages
126
+ WORKFLOW_UID_REQUIRED = "Workflow UID is required. Provide a valid Workflow UID and try again."
127
+ WORKFLOW_CONTENT_TYPE_UID_REQUIRED = "Content Type UID is required. Provide a valid Content Type UID and try again."
128
+ WORKFLOW_ENTRY_UID_REQUIRED = "Entry UID is required. Provide a valid Entry UID and try again."
129
+ WORKFLOW_RULE_UID_REQUIRED = "Rule UID is required. Provide a valid Rule UID and try again."
130
+
131
+
@@ -3,6 +3,7 @@ frontend code to pull content from the target branch associated with an alias.""
3
3
 
4
4
  import json
5
5
  from ..common import Parameter
6
+ from .._messages import ALIAS_UID_REQUIRED
6
7
  _path = 'stacks/branch_aliases'
7
8
 
8
9
 
@@ -47,7 +48,7 @@ class Alias(Parameter):
47
48
  --------------------------------
48
49
  """
49
50
  if self.alias_uid is None or '':
50
- raise Exception('alias_uid is required')
51
+ raise Exception(ALIAS_UID_REQUIRED)
51
52
  url = f"{_path}/{self.alias_uid}"
52
53
  return self.client.get(url, headers=self.client.headers, params=self.params)
53
54
 
@@ -8,6 +8,7 @@ import json
8
8
  from ..common import Parameter
9
9
  import mimetypes
10
10
  import os
11
+ from .._messages import ASSET_UID_REQUIRED, ASSET_TYPE_REQUIRED, ASSET_VERSION_NUMBER_REQUIRED
11
12
 
12
13
  class Assets(Parameter):
13
14
  """
@@ -62,7 +63,7 @@ class Assets(Parameter):
62
63
  """
63
64
 
64
65
  if self.asset_uid is None or '':
65
- raise Exception('asset_uid is required')
66
+ raise Exception(ASSET_UID_REQUIRED)
66
67
  url = f"assets/{self.asset_uid}"
67
68
  return self.client.get(url, headers = self.client.headers, params = self.params)
68
69
 
@@ -284,7 +285,7 @@ class Assets(Parameter):
284
285
  """
285
286
 
286
287
  if self.asset_uid is None or '':
287
- raise Exception('asset_uid is required')
288
+ raise Exception(ASSET_UID_REQUIRED)
288
289
  url = f"assets/{self.asset_uid}/versions"
289
290
  return self.client.get(url, headers = self.client.headers, params = self.params)
290
291
 
@@ -305,9 +306,9 @@ class Assets(Parameter):
305
306
  """
306
307
 
307
308
  if self.asset_uid is None or '':
308
- raise Exception('asset_uid is required')
309
+ raise Exception(ASSET_UID_REQUIRED)
309
310
  if version_number is None:
310
- raise Exception('Version Number is required')
311
+ raise Exception(ASSET_VERSION_NUMBER_REQUIRED)
311
312
  url = f"assets/{self.asset_uid}/versions/{version_number}/name"
312
313
  return self.client.delete(url, headers = self.client.headers, params = self.params)
313
314
 
@@ -326,7 +327,7 @@ class Assets(Parameter):
326
327
  """
327
328
 
328
329
  if self.asset_uid is None or '':
329
- raise Exception('asset_uid is required')
330
+ raise Exception(ASSET_UID_REQUIRED)
330
331
  url = f"assets/{self.asset_uid}/references"
331
332
  return self.client.get(url, headers = self.client.headers, params = self.params)
332
333
 
@@ -346,7 +347,7 @@ class Assets(Parameter):
346
347
  """
347
348
 
348
349
  if asset_type is None or '':
349
- raise Exception('asset_type is required')
350
+ raise Exception(ASSET_TYPE_REQUIRED)
350
351
  url = f"assets/{asset_type}"
351
352
  return self.client.get(url, headers = self.client.headers, params = self.params)
352
353
 
@@ -376,7 +377,7 @@ class Assets(Parameter):
376
377
 
377
378
  data = json.dumps(data)
378
379
  if self.asset_uid is None or '':
379
- raise Exception('asset_uid is required')
380
+ raise Exception(ASSET_UID_REQUIRED)
380
381
  url = f"assets/{self.asset_uid}"
381
382
  return self.client.put(url, headers = self.client.headers, params = self.params, data = data)
382
383
 
@@ -404,7 +405,7 @@ class Assets(Parameter):
404
405
 
405
406
  data = json.dumps(data)
406
407
  if self.asset_uid is None or '':
407
- raise Exception('asset_uid is required')
408
+ raise Exception(ASSET_UID_REQUIRED)
408
409
  url = f"assets/{self.asset_uid}"
409
410
  Parameter.add_header(self, "Content-Type", "multipart/form-data")
410
411
  return self.client.put(url, headers = self.client.headers, params = self.params, data = data)
@@ -439,7 +440,7 @@ class Assets(Parameter):
439
440
 
440
441
  data = json.dumps(data)
441
442
  if self.asset_uid is None or '':
442
- raise Exception('asset_uid is required')
443
+ raise Exception(ASSET_UID_REQUIRED)
443
444
  url = f"assets/{self.asset_uid}/publish"
444
445
  return self.client.post(url, headers = self.client.headers, data = data)
445
446
 
@@ -474,7 +475,7 @@ class Assets(Parameter):
474
475
 
475
476
  data = json.dumps(data)
476
477
  if self.asset_uid is None or '':
477
- raise Exception('asset_uid is required')
478
+ raise Exception(ASSET_UID_REQUIRED)
478
479
  url = f"assets/{self.asset_uid}/unpublish"
479
480
  return self.client.post(url, headers = self.client.headers, data = data)
480
481
 
@@ -5,6 +5,7 @@ the CRUD operations that can be performed on the API """
5
5
 
6
6
  from ..common import Parameter
7
7
  from .._errors import ArgumentException
8
+ from .._messages import LOG_ITEM_UID_REQUIRED
8
9
 
9
10
  class Auditlog(Parameter):
10
11
  """
@@ -58,6 +59,6 @@ class Auditlog(Parameter):
58
59
 
59
60
  def validate_uid(self):
60
61
  if self.log_item_uid is None or '':
61
- raise ArgumentException('Log item Uid is required')
62
+ raise ArgumentException(LOG_ITEM_UID_REQUIRED)
62
63
 
63
64
 
@@ -6,6 +6,7 @@ organized, and structured manner without impacting each other."""
6
6
  import json
7
7
 
8
8
  from contentstack_management.common import Parameter
9
+ from contentstack_management._messages import BRANCH_UID_REQUIRED
9
10
 
10
11
  _path = 'stacks/branches'
11
12
 
@@ -55,7 +56,7 @@ class Branch(Parameter):
55
56
  --------------------------------
56
57
  """
57
58
  if self.branch_uid is None or '':
58
- raise Exception('branch_uid is required field')
59
+ raise Exception(BRANCH_UID_REQUIRED)
59
60
  url = f"{_path}/{self.branch_uid}"
60
61
  return self.client.get(url, headers=self.client.headers, params=self.params)
61
62
 
@@ -101,6 +102,6 @@ class Branch(Parameter):
101
102
  --------------------------------
102
103
  """
103
104
  if self.branch_uid is None or '':
104
- raise Exception('branch_uid is required field')
105
+ raise Exception(BRANCH_UID_REQUIRED)
105
106
  url = f"{_path}/{self.branch_uid}"
106
107
  return self.client.delete(url, headers=self.client.headers, params=self.params)
@@ -7,6 +7,7 @@ import json
7
7
  from ..common import Parameter
8
8
  from urllib.parse import quote
9
9
  from .._errors import ArgumentException
10
+ from .._messages import JOB_UID_REQUIRED
10
11
 
11
12
  class BulkOperation(Parameter):
12
13
  """
@@ -313,7 +314,7 @@ class BulkOperation(Parameter):
313
314
  -------------------------------
314
315
  """
315
316
  if job_uid is None:
316
- raise ArgumentException("job_uid", "job_uid cannot be None")
317
+ raise ArgumentException(JOB_UID_REQUIRED)
317
318
  if headers is not None:
318
319
  self.client.headers.update(headers)
319
320
  url = f"{self.path}/jobs/{quote(job_uid)}"
@@ -6,6 +6,7 @@ import json
6
6
 
7
7
  from contentstack_management.common import Parameter
8
8
  from ..entries import entry
9
+ from .._messages import CONTENT_TYPE_UID_REQUIRED
9
10
 
10
11
  _path = 'content_types'
11
12
 
@@ -163,7 +164,7 @@ class ContentType(Parameter):
163
164
  """
164
165
  data = json.dumps(data)
165
166
  if self.content_type_uid is None or '':
166
- raise Exception('content_type_uid is required')
167
+ raise Exception(CONTENT_TYPE_UID_REQUIRED)
167
168
  url = f"{_path}/{self.content_type_uid}"
168
169
  return self.client.put(url, headers=self.client.headers, params=self.params, data=data)
169
170
 
@@ -347,5 +348,5 @@ class ContentType(Parameter):
347
348
 
348
349
  def entry(self, entry_uid: str =None):
349
350
  if self.content_type_uid is None:
350
- raise Exception('Content type uid is required')
351
+ raise Exception(CONTENT_TYPE_UID_REQUIRED)
351
352
  return entry.Entry(self.client, self.content_type_uid, entry_uid)
@@ -168,7 +168,8 @@ class Client:
168
168
  ... redirect_uri='http://localhost:3000/callback'
169
169
  ... )
170
170
  >>> auth_url = oauth_handler.authorize()
171
- >>> print(f"Visit this URL to authorize: {auth_url}")
171
+ >>> from contentstack_management._messages import OAUTH_VISIT_URL_TO_AUTHORIZE
172
+ >>> print(OAUTH_VISIT_URL_TO_AUTHORIZE.format(auth_url=auth_url))
172
173
  """
173
174
  return OAuthHandler(
174
175
  app_id=app_id,
@@ -6,6 +6,7 @@ the CRUD operations that can be performed on the API """
6
6
  import json
7
7
  from ..common import Parameter
8
8
  from .._errors import ArgumentException
9
+ from .._messages import DELIVERY_TOKEN_UID_REQUIRED
9
10
 
10
11
  class DeliveryToken(Parameter):
11
12
  """
@@ -191,4 +192,4 @@ class DeliveryToken(Parameter):
191
192
 
192
193
  def validate_uid(self):
193
194
  if self.delivery_token_uid is None or '':
194
- raise ArgumentException("Delivery Token Uid is required")
195
+ raise ArgumentException(DELIVERY_TOKEN_UID_REQUIRED)
@@ -6,6 +6,7 @@ the CRUD operations that can be performed on the API """
6
6
  import json
7
7
  from ..common import Parameter
8
8
  from ..entry_variants.entry_variants import EntryVariants
9
+ from .._messages import ENTRY_UID_REQUIRED, ENTRY_VERSION_NUMBER_REQUIRED, ENTRY_BODY_REQUIRED, ENTRY_FILE_PATH_REQUIRED
9
10
 
10
11
  class Entry(Parameter):
11
12
  """
@@ -59,7 +60,7 @@ class Entry(Parameter):
59
60
  -------------------------------
60
61
  """
61
62
  if self.entry_uid is None:
62
- raise Exception('Entry uid is required')
63
+ raise Exception(ENTRY_UID_REQUIRED)
63
64
  url = f"content_types/{self.content_type_uid}/entries/{self.entry_uid}"
64
65
  return self.client.get(url, headers = self.client.headers, params = self.params)
65
66
 
@@ -126,7 +127,7 @@ class Entry(Parameter):
126
127
  -------------------------------
127
128
  """
128
129
  if self.entry_uid is None:
129
- raise Exception('Entry uid is required')
130
+ raise Exception(ENTRY_UID_REQUIRED)
130
131
  url = url = f"content_types/{self.content_type_uid}/entries/{self.entry_uid}"
131
132
  self.params['locale'] = locale
132
133
  data = json.dumps(data)
@@ -161,11 +162,11 @@ class Entry(Parameter):
161
162
  -------------------------------
162
163
  """
163
164
  if self.entry_uid is None:
164
- raise Exception('Entry uid is required')
165
+ raise Exception(ENTRY_UID_REQUIRED)
165
166
  if version_number is None:
166
- raise Exception('Version Number is required')
167
+ raise Exception(ENTRY_VERSION_NUMBER_REQUIRED)
167
168
  if data is None:
168
- raise Exception('Body is required')
169
+ raise Exception(ENTRY_BODY_REQUIRED)
169
170
  url = f"content_types/{self.content_type_uid}/entries/{self.entry_uid}/versions/{version_number}/name"
170
171
  data = json.dumps(data)
171
172
  return self.client.post(url, headers = self.client.headers, data=data, params = self.params)
@@ -185,7 +186,7 @@ class Entry(Parameter):
185
186
  -------------------------------
186
187
  """
187
188
  if self.entry_uid is None:
188
- raise Exception('Entry uid is required')
189
+ raise Exception(ENTRY_UID_REQUIRED)
189
190
  url = f"content_types/{self.content_type_uid}/entries/{self.entry_uid}/references"
190
191
  return self.client.get(url, headers = self.client.headers, params = self.params)
191
192
 
@@ -204,7 +205,7 @@ class Entry(Parameter):
204
205
  -------------------------------
205
206
  """
206
207
  if self.entry_uid is None:
207
- raise Exception('Entry uid is required')
208
+ raise Exception(ENTRY_UID_REQUIRED)
208
209
  url = f"content_types/{self.content_type_uid}/entries/{self.entry_uid}/locales"
209
210
  return self.client.get(url, headers = self.client.headers, params = self.params)
210
211
 
@@ -247,9 +248,9 @@ class Entry(Parameter):
247
248
  -------------------------------
248
249
  """
249
250
  if self.entry_uid is None:
250
- raise Exception('Entry uid is required')
251
+ raise Exception(ENTRY_UID_REQUIRED)
251
252
  if data is None:
252
- raise Exception('Body is required')
253
+ raise Exception(ENTRY_BODY_REQUIRED)
253
254
  url = f"content_types/{self.content_type_uid}/entries/{self.entry_uid}"
254
255
  self.params['locale'] = locale
255
256
  data = json.dumps(data)
@@ -274,7 +275,7 @@ class Entry(Parameter):
274
275
  -------------------------------
275
276
  """
276
277
  if self.entry_uid is None:
277
- raise Exception('Entry uid is required')
278
+ raise Exception(ENTRY_UID_REQUIRED)
278
279
  url = f"content_types/{self.content_type_uid}/entries/{self.entry_uid}/unlocalize"
279
280
  self.params['locale'] = locale
280
281
  return self.client.post(url, headers = self.client.headers, params = self.params)
@@ -296,7 +297,7 @@ class Entry(Parameter):
296
297
  -------------------------------
297
298
  """
298
299
  if self.entry_uid is None:
299
- raise Exception('Entry uid is required')
300
+ raise Exception(ENTRY_UID_REQUIRED)
300
301
  url = f"content_types/{self.content_type_uid}/entries/{self.entry_uid}"
301
302
  self.params['force'] = True
302
303
  return self.client.delete(url, headers = self.client.headers, params = self.params)
@@ -325,7 +326,7 @@ class Entry(Parameter):
325
326
  -------------------------------
326
327
  """
327
328
  if file_path is None:
328
- raise Exception('File path is required')
329
+ raise Exception(ENTRY_FILE_PATH_REQUIRED)
329
330
  url = f"content_types/{self.content_type_uid}/entries/import"
330
331
  self.client.headers['Content-Type'] = "multipart/form-data"
331
332
  files = {'entry': open(f"{file_path}",'rb')}
@@ -347,7 +348,7 @@ class Entry(Parameter):
347
348
  -------------------------------
348
349
  """
349
350
  if self.entry_uid is None:
350
- raise Exception('Entry uid is required')
351
+ raise Exception(ENTRY_UID_REQUIRED)
351
352
  url = f"content_types/{self.content_type_uid}/entries/{self.entry_uid}/export"
352
353
  return self.client.get(url, headers = self.client.headers, params = self.params)
353
354
 
@@ -379,9 +380,9 @@ class Entry(Parameter):
379
380
  -------------------------------
380
381
  """
381
382
  if self.entry_uid is None:
382
- raise Exception('Entry uid is required')
383
+ raise Exception(ENTRY_UID_REQUIRED)
383
384
  if data is None:
384
- raise Exception('Body is required')
385
+ raise Exception(ENTRY_BODY_REQUIRED)
385
386
  url = f"content_types/{self.content_type_uid}/entries/{self.entry_uid}/publish"
386
387
  data = json.dumps(data)
387
388
  return self.client.post(url, headers = self.client.headers, data = data, params = self.params)
@@ -415,9 +416,9 @@ class Entry(Parameter):
415
416
  -------------------------------
416
417
  """
417
418
  if self.entry_uid is None:
418
- raise Exception('Entry uid is required')
419
+ raise Exception(ENTRY_UID_REQUIRED)
419
420
  if data is None:
420
- raise Exception('Body is required')
421
+ raise Exception(ENTRY_BODY_REQUIRED)
421
422
  url = f"content_types/{self.content_type_uid}/entries/{self.entry_uid}/unpublish"
422
423
  data = json.dumps(data)
423
424
  return self.client.post(url, headers = self.client.headers, data = data, params = self.params)
@@ -469,7 +470,7 @@ class Entry(Parameter):
469
470
  -------------------------------
470
471
  """
471
472
  if self.entry_uid is None:
472
- raise Exception('Entry uid is required')
473
+ raise Exception(ENTRY_UID_REQUIRED)
473
474
  if params is not None:
474
475
  self.params.update(params)
475
476
  self.params['include_variants'] = include_variants
@@ -6,6 +6,7 @@ the operations that can be performed on the API """
6
6
  import json
7
7
  from ..common import Parameter
8
8
  from .._errors import ArgumentException
9
+ from .._messages import ENTRY_VARIANT_CONTENT_TYPE_UID_REQUIRED, ENTRY_VARIANT_ENTRY_UID_REQUIRED, ENTRY_VARIANT_UID_REQUIRED
9
10
 
10
11
  class EntryVariants(Parameter):
11
12
  """
@@ -251,7 +252,7 @@ class EntryVariants(Parameter):
251
252
  """
252
253
 
253
254
  if self.content_type_uid is None or self.content_type_uid == '':
254
- raise ArgumentException("content type Uid is required")
255
+ raise ArgumentException(ENTRY_VARIANT_CONTENT_TYPE_UID_REQUIRED)
255
256
 
256
257
  def validate_entry_uid(self):
257
258
  """
@@ -260,7 +261,7 @@ class EntryVariants(Parameter):
260
261
  """
261
262
 
262
263
  if self.entry_uid is None or self.entry_uid == '':
263
- raise ArgumentException("entry Uid is required")
264
+ raise ArgumentException(ENTRY_VARIANT_ENTRY_UID_REQUIRED)
264
265
 
265
266
  def validate_variant_uid(self):
266
267
  """
@@ -269,4 +270,4 @@ class EntryVariants(Parameter):
269
270
  """
270
271
 
271
272
  if self.variant_uid is None or self.variant_uid == '':
272
- raise ArgumentException("variant Uid is required")
273
+ raise ArgumentException(ENTRY_VARIANT_UID_REQUIRED)
@@ -6,6 +6,7 @@ the CRUD operations that can be performed on the API """
6
6
  import json
7
7
  from ..common import Parameter
8
8
  from .._errors import ArgumentException
9
+ from .._messages import ENVIRONMENT_UID_REQUIRED
9
10
 
10
11
  class Environment(Parameter):
11
12
  """
@@ -135,4 +136,4 @@ class Environment(Parameter):
135
136
 
136
137
  def validate_uid(self):
137
138
  if self.environment_name is None or '':
138
- raise ArgumentException("Environments Uid is required")
139
+ raise ArgumentException(ENVIRONMENT_UID_REQUIRED)
@@ -6,6 +6,7 @@ the CRUD operations that can be performed on the API """
6
6
  import json
7
7
  from ..common import Parameter
8
8
  from .._errors import ArgumentException
9
+ from .._messages import EXTENSION_UID_REQUIRED
9
10
  from requests_toolbelt.multipart.encoder import MultipartEncoder
10
11
 
11
12
  class Extension(Parameter):
@@ -172,7 +173,7 @@ class Extension(Parameter):
172
173
 
173
174
  def validate_uid(self):
174
175
  if self.extension_uid is None or '':
175
- raise ArgumentException("Extension Uid is required")
176
+ raise ArgumentException(EXTENSION_UID_REQUIRED)
176
177
 
177
178
  def encode_multipart_formdata(self, fields):
178
179
  # Create a MultipartEncoder instance with the specified fields
@@ -4,6 +4,7 @@ The create(), read(), update(), and delete() methods each correspond to
4
4
  the CRUD operations that can be performed on the API """
5
5
 
6
6
  import json
7
+ from .._messages import GLOBAL_FIELD_UID_REQUIRED
7
8
 
8
9
  from contentstack_management.common import Parameter
9
10
 
@@ -179,7 +180,7 @@ class GlobalFields(Parameter):
179
180
  -------------------------------
180
181
  """
181
182
  if self.global_field_uid is None or '':
182
- raise Exception('global_field_uid is required')
183
+ raise Exception(GLOBAL_FIELD_UID_REQUIRED)
183
184
  url = f"{_path}/{self.global_field_uid}/export"
184
185
  response = self.client.get(url, headers=self.client.headers, params=self.params)
185
186
  # Remove the api_version header after request
@@ -6,6 +6,7 @@ the CRUD operations that can be performed on the API """
6
6
  import json
7
7
  from ..common import Parameter
8
8
  from .._errors import ArgumentException
9
+ from .._messages import LABEL_UID_REQUIRED
9
10
 
10
11
  class Label(Parameter):
11
12
  """
@@ -167,4 +168,4 @@ class Label(Parameter):
167
168
  """
168
169
 
169
170
  if self.label_uid is None or '':
170
- raise ArgumentException("label Uid is required")
171
+ raise ArgumentException(LABEL_UID_REQUIRED)