Skip to content

Commit 10b74b4

Browse files
⚡ general clean up
1 parent 0725f18 commit 10b74b4

24 files changed

+2253
-29
lines changed

.talismanrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
threshold: medium

CHANGELOG.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
# CHANGELOG
22

3+
## _v1.6.0_
4+
5+
============
6+
7+
### **Date: 11-Aug-2021**
8+
9+
Live Preview support added.
10+
11+
- Stack.live_preview_query function added in Stack
12+
- live preview funtions added in config
13+
314
## _v1.5.1_
415

516
============
617

7-
### Date: 1-Aug-2021
18+
### **Date: 1-Aug-2021**
819

920
Issue #17 resolved.
1021
Stack.sync_init uses wrong parameter names
@@ -13,20 +24,22 @@ Stack.sync_init uses wrong parameter names
1324

1425
============
1526

16-
### Date: 22-Jul-2021
27+
### **Date: 22-Jul-2021**
1728

1829
contentstack-utils updated to v1.1.0
1930

2031
## _v1.4.0_
2132

2233
============
2334

24-
### Date: 05-Apr-2021
35+
### **Date: 05-Apr-2021**
2536

26-
Entry - include_embedded_objects support added
27-
Query - include_embedded_objects support added
37+
Entry
38+
- include_embedded_objects support added
39+
Query
40+
- include_embedded_objects support added
2841

29-
---
42+
-----------------------------
3043

3144
## _v1.3.0_
3245

@@ -37,7 +50,7 @@ Date: 26-Feb-2021
3750
- Retry policy and timeout support included
3851
- Set default timeout 30 sec
3952

40-
---
53+
-----------------------------
4154

4255
## _v1.2.0_
4356

@@ -57,7 +70,7 @@ Date: 08-Dec-2020
5770
- Query
5871
- added support for include_fallback.
5972

60-
---
73+
-----------------------------
6174

6275
## _v1.1.0_
6376

@@ -67,7 +80,7 @@ EntryQueryable
6780

6881
- updated include_reference function.
6982

70-
---
83+
-----------------------------
7184

7285
## _v1.0.0_
7386

@@ -91,12 +104,12 @@ Query
91104

92105
- Changes incorporated in the Query class.
93106

94-
---
107+
-----------------------------
95108

96109
## _v0.1.0_
97110

98111
November-18, 2019 -beta release
99112

100113
Initial release for the contentstack-python-sdk for Content Delivery API
101114

102-
---
115+
-----------------------------

README.md

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
#
2+
3+
[![Contentstack](https://www.contentstack.com/docs/static/images/contentstack.png)](https://www.contentstack.com/)
4+
5+
<!-- ![Python package](https://github.com/contentstack/contentstack-python/workflows/Python%20package/badge.svg?branch=master) -->
6+
7+
![build](https://img.shields.io/badge/build-passing-green?style=plastic)
8+
![Coverage](https://raw.githubusercontent.com/contentstack/contentstack-python/b4edf799276f586dce3e57fa5502036cd5fd8da3/coverage.svg) ![pip](https://img.shields.io/badge/pip-v1.6.0-blue?style=plastic) ![python](https://img.shields.io/badge/python-3.5|3.6|3.7|3.8-blue?style=plastic) [![GitHub license](https://img.shields.io/github/license/contentstack/contentstack-python?style=plastic)](https://github.com/contentstack/contentstack-python/blob/master/LICENSE) [![GitHub stars](https://img.shields.io/github/stars/contentstack/contentstack-python?style=plastic)](https://github.com/contentstack/contentstack-python/stargazers)
9+
10+
## Python SDK for Contentstack
11+
12+
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/).
13+
14+
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.
15+
16+
### Prerequisite
17+
18+
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+
20+
### Setup and Installation
21+
22+
To use the Contentstack Python SDK to your existing project, perform the steps given below:
23+
24+
### Install contentstack pip
25+
26+
```pyhton
27+
pip install contentstack
28+
```
29+
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
31+
32+
### Key Concepts for using Contentstack
33+
34+
#### Stack
35+
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).
37+
38+
#### Content Type
39+
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).
41+
42+
#### Entry
43+
44+
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).
45+
46+
#### Asset
47+
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).
49+
50+
#### Environment
51+
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).
53+
54+
### Contentstack Python SDK: 5-minute Quickstart
55+
56+
#### Initializing your SDK
57+
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:
59+
60+
```python
61+
stack = contentstack.Stack('api_key','delivery_token','environment')
62+
```
63+
64+
To get the API credentials mentioned above, log in to your Contentstack account and then in your top panel navigation, go to Settings &gt; Stack to view the API Key and Access Token.
65+
66+
#### Querying content from your stack
67+
68+
To retrieve a single entry from a content type use the code snippet given below:
69+
70+
```python
71+
stack = contentstack.Stack('api_key','delivery_token','environment')
72+
content_type = stack.content_type("content_type_uid")
73+
entry = content_type.entry("entry_uid")
74+
result = entry.fetch()
75+
```
76+
77+
##### Get Multiple Entries
78+
79+
To retrieve multiple entries of a particular content type, use the code snippet given below:
80+
81+
```python
82+
stack = contentstack.Stack('api_key','delivery_token','environment')
83+
query = stack.content_type("content_type_uid").query()
84+
result = query.find()
85+
```
86+
87+
### Advanced Queries
88+
89+
You can query for content types, entries, assets and more using our Python API Reference.
90+
91+
[Python API Reference Doc](https://www.contentstack.com/docs/platforms/python/api-reference/)
92+
93+
### Working with Images
94+
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.
96+
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.
98+
99+
[`Read Image Delivery API documentation`](https://www.contentstack.com/docs/platforms/python/api-reference/).
100+
101+
You can use the Image Delivery API functions in this SDK as well. Here are a few examples of its usage in the SDK.
102+
103+
```python
104+
image = stack.image_transform(url, {'quality': 100}).get_url()
105+
image = stack.image_transform(url, {'width': 100, 'height': 100}).get_url()
106+
image = stack.image_transform(url, {'auto': 'webp'}).get_url()
107+
```
108+
109+
### Using the Sync API with Python SDK
110+
111+
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.
112+
113+
```python
114+
stack = contentstack.Stack('api_key','delivery_token','environment') #initialize sync
115+
response = stack.sync_init() #sycn using sync token
116+
response = stack.sync_token('sync_token') #sycn using pagination token
117+
response = stack.pagination('pagination_token') #sync using multiple parameters
118+
response = stack.sync_init(publish_type='entry_published', content_type_uid='content_type_uid')
119+
```
120+
121+
Read through to understand how to use the Sync API with Contentstack Python SDK.
122+
123+
[`Using the Sync API with Python SDK`](https://www.contentstack.com/docs/developers/python/using-the-sync-api-with-python-sdk)
124+
125+
### Helpful Links
126+
127+
- [`Contentstack Website`](https://www.contentstack.com)
128+
- [`Official Documentation`](https://contentstack.com/docs)
129+
- [`Content Delivery API Docs`](https://www.contentstack.com/docs/developers/apis/content-delivery-api/)
130+
131+
### The MIT License (MIT)
132+
133+
Copyright © 2012-2021 [`Contentstack`](https://www.contentstack.com/). All Rights Reserved
134+
135+
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:
136+
137+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
138+
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.
140+
141+
- [`Content Delivery API Docs`](https://contentstack.com/docs/apis/content-delivery-api/)

README.rst

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
================
2+
**Contentstack**
3+
================
4+
5+
Python SDK for Contentstack
6+
===========================
7+
8+
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/>`_.
9+
10+
Contentstack provides Python SDK to build an application on top of Python. Given below is the detailed guide and helpful resources to get started with our Python SDK.
11+
12+
Prerequisite
13+
============
14+
15+
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>`_
16+
17+
Setup and Installation
18+
======================
19+
20+
To use the Contentstack Python SDK to your existing project, perform the steps given below:
21+
22+
.. code-block:: python
23+
install contentstack pip
24+
25+
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/>`_
26+
installed, this `Python installation guide <http://docs.python-guide.org/en/latest/starting/installation/>`_ can guide you through the process
27+
28+
29+
Key Concepts for using Contentstack
30+
-----------------------------------
31+
32+
**Stack**
33+
34+
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>`_.
35+
36+
**Content-Type**
37+
38+
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>`_.
39+
40+
**Entry**
41+
42+
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>`_.
43+
44+
**Asset**
45+
46+
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>`_.
47+
48+
**Environment**
49+
50+
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)>`_.
51+
52+
53+
54+
Contentstack Python SDK: 5-minute Quickstart
55+
--------------------------------------------
56+
57+
**Initializing your SDK**
58+
59+
To initialize the SDK, specify the application API key, access token, and environment name of the stack as shown in the snippet given below:
60+
61+
.. code-block:: python
62+
63+
stack = contentstack.Stack('api_key', 'delivery_token', 'environment')
64+
65+
66+
To get the API credentials mentioned above, log in to your Contentstack account and then in your top panel navigation, go to Settings &gt; Stack to view the API Key and Access Token.
67+
68+
69+
70+
**Querying content from your stack**
71+
72+
To retrieve a single entry from a content type use the code snippet given below:
73+
74+
.. code-block:: python
75+
76+
content_type = stack.content_type("content_type_uid")
77+
entry = content_type.entry("entry_uid")
78+
result = entry.fetch()
79+
80+
81+
**Get Multiple Entries**
82+
83+
To retrieve multiple entries of a particular content type, use the code snippet given below:
84+
85+
86+
**stack is an instance of Stack class**
87+
88+
.. code-block:: python
89+
90+
query = stack.content_type("content_type_uid").query()
91+
result = query.find()
92+
93+
**Advanced Queries**
94+
95+
You can query for content types, entries, assets, and more using our Java API Reference. `Python API Reference Doc <https://www.contentstack.com/docs/platforms/python/api-reference/>`_
96+
97+
98+
**Working with Images**
99+
100+
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.
101+
102+
*For example:*
103+
104+
If you want to crop an image (with a width of 300 and height of 400), you simply need to append query parameters at the end of the image URL, such as
105+
106+
.. code-block:: python
107+
108+
https://images.contentstack.io/v3/assets/download?crop=300,400
109+
110+
111+
There are several more parameters that you can use for your images. `Read Image Delivery API documentation <https://www.contentstack.com/docs/platforms/python/api-reference/>`_
112+
113+
You can use the Image Delivery API functions in this SDK as well. Here are a few examples of its usage in the SDK.
114+
115+
.. code-block:: python
116+
117+
url = stack.image_transform(image_url, {'quality': 100})
118+
url = stack.image_transform(imageUrl, {'width': 100, 'height': 100})
119+
url = stack.image_transform(imageUrl, {'auto': 'webp'})
120+
121+
**Using the Sync API with Python SDK**
122+
123+
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.
124+
125+
Read through to understand how to use the Sync API with Contentstack Python SDK. `Using the Sync API with Python SDK <https://www.contentstack.com/docs/developers/python/using-the-sync-api-with-python-sdk>`_
126+
127+
128+
**Helpful Links**
129+
130+
`Contentstack Website <https://www.contentstack.com>`_
131+
132+
`Official Documentation <https://www.contentstack.com/docs/developers/apis/content-delivery-api/>`_
133+
134+
`Content Delivery API Docs <https://www.contentstack.com/docs/developers/apis/content-delivery-api>`_.
135+
136+
137+
The MIT License (MIT)
138+
^^^^^^^^^^^^^^^^^^^^^
139+
140+
Copyright © 2012-2020 Contentstack. All Rights Reserved 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:
141+
142+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
143+
144+
*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*

changelog.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
**CHANGELOG**
33
================
44

5+
*v1.6.0*
6+
============
7+
8+
**Date: 11-Aug-2021**
9+
10+
Live Preview support added.
11+
- Stack.live_preview_query function added in Stack
12+
- live preview functions added in config
13+
514
*v1.5.1*
615
============
716

0 commit comments

Comments
 (0)