Skip to content

Commit 93b561f

Browse files
Update entry.py
1 parent 3c07410 commit 93b561f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

contentstack_management/entries/entry.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def __init__(self, client, content_type_uid, entry_uid):
2424

2525
self.path = f"content_types/{content_type_uid}/entries/"
2626

27-
def find(self):
27+
def find(self, locale=None):
2828
"""
2929
The Get all entries call fetches the list of all the entries of a particular content type.
3030
It also returns the content of each entry in JSON format. You can also specify the environment and locale of which you wish to get the entries.
@@ -41,11 +41,13 @@ def find(self):
4141
"""
4242

4343
url = f"content_types/{self.content_type_uid}/entries"
44+
if locale:
45+
self.params['locale'] = locale
4446
return self.client.get(url, headers = self.client.headers, params = self.params)
4547

4648

4749

48-
def fetch(self):
50+
def fetch(self, locale=None):
4951
"""
5052
The Get a single entry request fetches a particular entry of a content type.
5153
:return: the response object.
@@ -62,6 +64,8 @@ def fetch(self):
6264
if self.entry_uid is None:
6365
raise Exception(ENTRY_UID_REQUIRED)
6466
url = f"content_types/{self.content_type_uid}/entries/{self.entry_uid}"
67+
if locale:
68+
self.params['locale'] = locale
6569
return self.client.get(url, headers = self.client.headers, params = self.params)
6670

6771

@@ -477,4 +481,4 @@ def includeVariants(self, include_variants: str = 'true', variant_uid: str = Non
477481
if variant_uid is not None and variant_uid != '':
478482
self.params['variant_uid'] = variant_uid
479483
url = f"content_types/{self.content_type_uid}/entries/{self.entry_uid}"
480-
return self.client.get(url, headers = self.client.headers, params = self.params)
484+
return self.client.get(url, headers = self.client.headers, params = self.params)

0 commit comments

Comments
 (0)