Skip to content

Commit e9c19cd

Browse files
shaileshmishrashaileshmishra
authored andcommitted
include_fallback added
1 parent a871e77 commit e9c19cd

File tree

8 files changed

+103
-92
lines changed

8 files changed

+103
-92
lines changed

CHANGELOG.md

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,44 @@
11
# CHANGELOG
22

3-
Date: 10-Aug-2020 - include_reference issue fixed
3+
4+
*v1.2.0*
5+
============
6+
7+
_Date: 20-Oct-2020_
8+
9+
- include_fallback Support Added
10+
- Timeout support included
11+
12+
- Entry
13+
- added support for include_fallback.
14+
- Asset
15+
- added support for include_fallback.
16+
- AssetQueryable
17+
- added support for include_fallback.
18+
- Query
19+
- added support for include_fallback.
20+
21+
-----------------------------
22+
23+
24+
425

526
## _v1.1.0_
627

28+
_Date: 10-Aug-2020 - include_reference issue fixed_
29+
730
EntryQueryable
831

932
- updated include_reference function.
1033

1134
-----------------------------
1235

13-
Date: 17-Jun-2020 - initial release
36+
1437

1538
## _v1.0.0_
1639

40+
_Date: 17-Jun-2020 - initial release_
41+
1742
Stack
1843

1944
- Initialisation of stack has been modified
@@ -34,11 +59,10 @@ Query
3459

3560
-----------------------------
3661

37-
Date: 18-Nov-2019 - beta release
3862

3963
## _v0.1.0_
4064

41-
November-18, 2019 -beta release
65+
_November-18, 2019 -beta release_
4266

4367
Initial release for the contentstack-python-sdk for Content Delivery API
4468

changelog.rst

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,64 @@
1-
=========
2-
CHANGELOG
3-
=========
1+
================
2+
**CHANGELOG**
3+
================
4+
5+
*v1.2.0*
6+
============
7+
8+
**Date: 20-Oct-2020**
9+
10+
- include_fallback Support Added
11+
- Timeout support included
12+
13+
14+
**Entry**
15+
- Added support for include_fallback.
16+
**Asset**
17+
- Added support for include_fallback.
18+
**AssetQuery**
19+
- Added support for include_fallback.
20+
**Query**
21+
- Added support for include_fallback.
22+
23+
============
24+
425

5-
Date: 10-Aug-2020 - include_reference issue fixed
626

727
*v1.1.0*
828
============
929

10-
EntryQueryable
11-
- updated include_reference function.
30+
**Date: 10-Aug-2020 :: include_reference issue fixed**
31+
32+
**EntryQueryable**
33+
- updated include_reference function.
1234

1335
============
1436

15-
Date: 17-Jun-2020 - initial release
1637

1738
*v1.0.0*
1839
============
1940

20-
Stack
41+
**Date: 17-Jun-2020 :: Initial Release**
42+
43+
**Stack**
2144
- Initialization of the stack has been modified
2245
- External config support moved to stack initialization optional parameters
2346

24-
Asset
47+
**Asset**
2548
- changes incorporated in Asset class.
2649

27-
Entry
50+
**Entry**
2851
- changes incorporated in the entry class.
2952

30-
Query
53+
**Query**
3154
- Changes incorporated in the Query class.
3255

3356
-----------------------------
3457

35-
Date: 18-Nov-2019 - beta release
3658

3759
*v0.0.1*
3860
============
61+
62+
**Date: 18-Nov-2019 :: Beta Release**
63+
3964
- Beta release for the contentstack-python SDK for Content Delivery API

contentstack/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@
1919
__title__ = 'contentstack-python'
2020
__author__ = 'Contentstack'
2121
__status__ = 'debug'
22-
__version__ = '1.1.0'
22+
__version__ = '1.2.0'
2323
__endpoint__ = 'cdn.contentstack.io'
2424
__email__ = '[email protected]'

contentstack/assetquery.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,22 @@ def relative_url(self):
9797
"""
9898
self.__query_params["relative_urls"] = "true"
9999
return self
100+
101+
def include_fallback(self):
102+
r"""Include the fallback locale publish content, if specified locale content is not publish.
103+
104+
:return: AssetQuery, so we can chain the call
105+
106+
----------------------------
107+
Example::
108+
109+
>>> import contentstack
110+
>>> stack = contentstack.Stack('api_key', 'delivery_token', 'environment')
111+
>>> result = stack.asset_query().include_fallback().find()
112+
----------------------------
113+
"""
114+
self.__query_params['include_fallback'] = "true"
115+
return self
100116

101117
def find(self):
102118
r"""This call fetches the list of all the assets of a particular stack.

contentstack/entryqueryable.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def excepts(self, field_uid: str):
7373

7474
def include_reference(self, field_uid):
7575
"""
76-
**Include Reference:**
76+
**[Include Reference]:**
7777
When you fetch an entry of a content type that has a reference field,
7878
by default, the content of the referred entry is not fetched.
7979
It only fetches the UID of the referred entry, along with the content of
@@ -112,9 +112,7 @@ def include_content_type(self):
112112
>>> entry = content_type.entry('uid')
113113
>>> entry.include_content_type()
114114
>>> result = entry.fetch()
115-
116115
-------------------------------
117-
118116
[Example: for Query:]
119117
120118
>>> import contentstack

contentstack/https_connection.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010

1111
import requests
1212
from requests.exceptions import Timeout, HTTPError
13-
1413
import contentstack
1514

15+
# from requests.adapters import HTTPAdapter
16+
# from requests.packages.urllib3.util.retry import Retry
17+
1618

1719
def get_os_platform():
1820
""" returns client platform """
@@ -52,9 +54,19 @@ def get(self, url):
5254
We use requests.get method since we are sending a GET request.
5355
The four arguments we pass are url, verify(ssl), timeout, headers
5456
"""
57+
58+
# retry_strategy = Retry(
59+
# total=3,
60+
# status_forcelist=[429, 500, 502, 503, 504],
61+
# method_whitelist=["GET"]
62+
# )
63+
# adapter = HTTPAdapter(max_retries=retry_strategy)
64+
# http = requests.Session()
65+
# http.mount("https://", adapter)
66+
5567
try:
5668
self.headers.update(user_agents())
57-
response = requests.get(url, verify=True, headers=self.headers)
69+
response = requests.get(url, verify=True, timeout=(10, 8), headers=self.headers)
5870
response.encoding = 'utf-8'
5971
return response.json()
6072
except Timeout:

contentstack/utility.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ def do_url_encode(params):
6363

6464
@staticmethod
6565
def get_complete_url(base_url: str, params: dict):
66-
""" creates complete url using base_url and their respective parameters
66+
"""
67+
creates complete url using base_url and their respective parameters
6768
:param base_url:
6869
:param params:
6970
:return:

requirements.txt

Lines changed: 4 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,7 @@
1-
aenum==2.2.3
2-
alabaster==0.7.12
3-
astroid==2.4.1
4-
attrs==19.3.0
5-
Babel==2.8.0
6-
bleach==3.1.5
7-
certifi==2020.6.20
8-
chardet==3.0.4
9-
click==7.1.2
10-
coverage==5.2.1
11-
coverage-badge==1.0.1
12-
dnspython==2.0.0
131
docutils==0.16
14-
dparse==0.5.1
15-
entrypoints==0.3
16-
enum34==1.1.10
17-
env==0.1.0
18-
eventlet==0.25.2
19-
greenlet==0.4.15
20-
html-testRunner==1.2.1
21-
idna==2.10
22-
imagesize==1.2.0
23-
importlib-metadata==0.23
24-
iniconfig==1.0.0
25-
isort==4.3.21
26-
itsdangerous==1.1.0
27-
Jinja2==3.0.0a1
28-
keyring==21.3.0
29-
lazy-object-proxy==1.4.3
30-
MarkupSafe==2.0.0a1
31-
mccabe==0.6.1
32-
monotonic==1.5
33-
more-itertools==7.2.0
34-
packaging==20.4
35-
pip-autoremove==0.9.1
36-
pipdeptree==1.0.0
37-
piplint==0.2.0
2+
keyring==21.4.0
383
pkginfo==1.5.0.1
39-
pluggy==0.13.1
40-
py==1.9.0
41-
Pygments==2.6.1
42-
pylint==2.5.2
43-
pyparsing==3.0.0a2
44-
pytest==6.0.1
45-
pytest-cov==2.9.0
46-
pytz==2020.1
47-
PyYAML==5.3.1
48-
readme-renderer==24.0
494
requests==2.24.0
50-
requests-toolbelt==0.9.1
51-
safety==1.9.0
52-
six==1.15.0
53-
snowballstemmer==2.0.0
54-
Sphinx==3.1.2
55-
sphinx-rtd-theme==0.4.3
56-
sphinxcontrib-applehelp==1.0.2
57-
sphinxcontrib-devhelp==1.0.2
58-
sphinxcontrib-htmlhelp==1.0.3
59-
sphinxcontrib-jsmath==1.0.1
60-
sphinxcontrib-qthelp==1.0.3
61-
sphinxcontrib-serializinghtml==1.1.4
62-
toml==0.10.1
63-
tqdm==4.38.0
64-
twine==3.1.1
65-
typed-ast==1.4.1
66-
urllib3==1.25.10
67-
virtualenv==16.7.9
68-
wcwidth==0.2.5
69-
webencodings==0.5.1
70-
Werkzeug==1.0.1
71-
wrapt==1.11.2
72-
zipp==3.1.0
5+
pip~=20.2.3
6+
py~=1.9.0
7+
setuptools~=50.3.0

0 commit comments

Comments
 (0)