Contentstack offers the Python Management SDK that leverages Content Management APIs to help you efficiently manage your content within your Contentstack account.
With this SDK, you can seamlessly create, update, delete, and retrieve content.
Explore our tutorials and guides for seamless integration with Contentstack's supported tools and start your project effortlessly.
Note: The Contentstack Python Management SDK supports Python 3 version 3.7 or later.
To seamlessly integrate your Python application with Contentstack’s Python Management SDK, follow the steps outlined in the Get Started with Python Management SDK documentation.
Here are some of the key features of the Python Management SDK:
Here is an example of how you can start using the Python Management SDK.
To initialize the SDK and import its library into your system, execute the following command:
import contentstack_management
client = contentstack_management.Client(authtoken= 'authtoken')To retrieve the details of your stack, execute the following command:
result = client.stack(api_key= 'api_key').fetch().json()
print(result)Once you have access to the stack instance, you can execute any query.
For example, if you need to upload an asset in your stack, execute the following command:
“# prepare your request body”
asset = {
upload: 'path/to/file',
title: 'Asset Title'
}
asset = client.stack(api_key='api_key').assets()
result = asset.upload(asset)