You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+53-24Lines changed: 53 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,13 +7,17 @@
7
7
8
8
## Python SDK for Contentstack
9
9
10
-
Contentstack is a headless CMS with an API-first approach. It is a CMS that developers can use to build powerful cross-platform applications in their favorite languages. Build your application frontend, and Contentstack will take care of the rest. [Read More](https://www.contentstack.com/).
10
+
Contentstack is a headless CMS with an API-first approach. It is a CMS that developers can use to build powerful
11
+
cross-platform applications in their favorite languages. Build your application frontend, and Contentstack will take
12
+
care of the rest. [Read More](https://www.contentstack.com/).
11
13
12
-
Contentstack provides Python SDK to build application on top of Python. Given below is the detailed guide and helpful resources to get started with our Python SDK.
14
+
Contentstack provides Python SDK to build application on top of Python. Given below is the detailed guide and helpful
15
+
resources to get started with our Python SDK.
13
16
14
17
### Prerequisite
15
18
16
-
You will need python 3 installed on your machine. You can install it from [here](https://www.python.org/ftp/python/3.7.4/python-3.7.4-macosx10.9.pkg).
19
+
You will need python 3 installed on your machine. You can install it
20
+
from [here](https://www.python.org/ftp/python/3.7.4/python-3.7.4-macosx10.9.pkg).
17
21
18
22
### Setup and Installation
19
23
@@ -27,48 +31,61 @@ pip install contentstack
27
31
28
32
Install latest [contentstack](https://pypi.org/project/Contentstack) package from the [PyPI](https://pypi.org)
29
33
30
-
This is the preferred method to install contentstack, as it will always install the most recent stable release. If you don't have [pip](https://pip.pypa.io/) installed, this [Python installation guide](http://docs.python-guide.org/en/latest/starting/installation/) can guide you through the process
34
+
This is the preferred method to install contentstack, as it will always install the most recent stable release. If you
35
+
don't have [pip](https://pip.pypa.io/) installed,
36
+
this [Python installation guide](http://docs.python-guide.org/en/latest/starting/installation/) can guide you through
37
+
the process
31
38
32
39
### Key Concepts for using Contentstack
33
40
34
41
#### Stack
35
42
36
-
A stack is like a container that holds the content of your app. Learn more about [Stacks](https://www.contentstack.com/docs/developers/set-up-stack).
43
+
A stack is like a container that holds the content of your app. Learn more
44
+
about [Stacks](https://www.contentstack.com/docs/developers/set-up-stack).
37
45
38
46
#### Content Type
39
47
40
-
Content type lets you define the structure or blueprint of a page or a section of your digital property. It is a form-like page that gives Content Managers an interface to input and upload content. [Read more](https://www.contentstack.com/docs/developers/create-content-types).
48
+
Content type lets you define the structure or blueprint of a page or a section of your digital property. It is a
49
+
form-like page that gives Content Managers an interface to input and upload
An entry is the actual piece of content created using one of the defined content types. Learn more about [Entries](https://www.contentstack.com/docs/content-managers/work-with-entries).
54
+
An entry is the actual piece of content created using one of the defined content types. Learn more
55
+
about [Entries](https://www.contentstack.com/docs/content-managers/work-with-entries).
45
56
46
57
#### Asset
47
58
48
-
Assets refer to all the media files (images, videos, PDFs, audio files, and so on) uploaded to Contentstack. These files can be used in multiple entries. Read more about [Assets](https://www.contentstack.com/docs/content-managers/work-with-assets).
59
+
Assets refer to all the media files (images, videos, PDFs, audio files, and so on) uploaded to Contentstack. These files
60
+
can be used in multiple entries. Read more
61
+
about [Assets](https://www.contentstack.com/docs/content-managers/work-with-assets).
49
62
50
63
#### Environment
51
64
52
-
A publishing environment corresponds to one or more deployment servers or a content delivery destination where the entries need to be published. Learn how to work with [Environments](https://www.contentstack.com/docs/developers/set-up-environments).
65
+
A publishing environment corresponds to one or more deployment servers or a content delivery destination where the
66
+
entries need to be published. Learn how to work
67
+
with [Environments](https://www.contentstack.com/docs/developers/set-up-environments).
53
68
54
69
### Contentstack Python SDK: 5-minute Quickstart
55
70
56
71
#### Initializing your SDK
57
72
58
-
To initialize the SDK, specify application API key, access token, and environment name of the stack as shown in the snippet given below, You can provide optional parameters for config:
73
+
To initialize the SDK, specify application API key, access token, and environment name of the stack as shown in the
74
+
snippet given below, You can provide optional parameters for config:
To get the API credentials mentioned above, log in to your Contentstack account and then in your top panel navigation, go to Settings > Stack to view the API Key and Access Token.
80
+
To get the API credentials mentioned above, log in to your Contentstack account and then in your top panel navigation,
81
+
go to Settings > Stack to view the API Key and Access Token.
65
82
66
83
#### Querying content from your stack
67
84
68
85
To retrieve a single entry from a content type use the code snippet given below:
@@ -92,9 +109,12 @@ You can query for content types, entries, assets and more using our Python API R
92
109
93
110
### Working with Images
94
111
95
-
We have introduced Image Delivery APIs that let you retrieve images and then manipulate and optimize them for your digital properties. It lets you perform a host of other actions such as crop, trim, resize, rotate, overlay, and so on.
112
+
We have introduced Image Delivery APIs that let you retrieve images and then manipulate and optimize them for your
113
+
digital properties. It lets you perform a host of other actions such as crop, trim, resize, rotate, overlay, and so on.
96
114
97
-
For example, if you want to crop an image (with width as 300 and height as 400), you simply need to append query parameters at the end of the image URL, such as, `https://images.contentstack.io/v3/assets/download?crop=300,400`. There are several more parameters that you can use for your images.
115
+
For example, if you want to crop an image (with width as 300 and height as 400), you simply need to append query
116
+
parameters at the end of the image URL, such as, `https://images.contentstack.io/v3/assets/download?crop=300,400`. There
117
+
are several more parameters that you can use for your images.
98
118
99
119
[Read Image Delivery API documentation](https://www.contentstack.com/docs/platforms/python/api-reference/).
The Sync API takes care of syncing your Contentstack data with your application and ensures that the data is always up-to-date by providing delta updates. Contentstack’s Python SDK supports Sync API, which you can use to build powerful applications.
131
+
The Sync API takes care of syncing your Contentstack data with your application and ensures that the data is always
132
+
up-to-date by providing delta updates. Contentstack’s Python SDK supports Sync API, which you can use to build powerful
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:
157
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
158
+
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
159
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
160
+
persons to whom the Software is furnished to do so, subject to the following conditions:
136
161
137
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
162
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
163
+
Software.
138
164
139
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
165
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
166
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
167
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
168
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
140
169
141
170
-[Content Delivery API Docs](https://contentstack.com/docs/apis/content-delivery-api/)
0 commit comments