Registry / crm-productivity / contentstack-utils

contentstack-utils

JSON →
library1.5.0pypypiunverified

contentstack_utils is a Python utility package designed to assist with processing data from the Contentstack headless CMS. Its primary function is to convert Rich Text Editor (RTE) content, including Supercharged RTE (SRTE) with embedded items, from Contentstack's JSON format into HTML. The current version is 1.5.0, with minor releases happening every few months.

pip install contentstack-utils
INSTALL
IMPORT
SIG · CONTENTSTACK-UTILS
C
contentstack-utils
crm-productivitypythonv1.5.0
Install
1.6s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.5.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.1MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ContentstackUtils
from contentstack_utils import ContentstackUtils
from contentstack_utils import ContentstackUtils

This quickstart demonstrates how to convert a Contentstack Rich Text Editor (RTE) JSON structure into renderable HTML using the `ContentstackUtils.json_to_html` method. This is the most common use case for the library.

import json from contentstack_utils import ContentstackUtils # Sample Rich Text Editor JSON from Contentstack # This structure is typically found under the 'json' key of an RTE field. rte_content_json = [ { "type": "doc", "children": [ { "type": "p", "children": [ { "text": "Hello from Contentstack Rich Text Editor!" } ] }, { "type": "p", "children": [ { "type": "a", "attrs": { "href": "https://www.contentstack.com", "target": "_blank", "rel": ["noopener", "noreferrer"] }, "children": [ { "text": "Visit Contentstack" } ] } ] } ] } ] # Convert the RTE JSON to HTML html_output = ContentstackUtils.json_to_html(rte_content_json) print("Converted HTML output:") print(html_output)
Debug
Known issues
gotchaThis library only handles processing existing Contentstack data (like RTE content) and does NOT provide functionality for fetching data from Contentstack. You must use the official Contentstack Python SDK or another HTTP client to retrieve entry data first.
fix
Use the `contentstack-sdk-python` library to fetch content entries from Contentstack, then pass the relevant RTE JSON to `contentstack-utils` for processing.
affects: All versions
breakingVersions 1.1.0 (SRTE Support) and 1.2.1 (GraphQL SRTE support) introduced significant changes to how Rich Text Editor content, especially Supercharged RTE (SRTE) with embedded items, is handled. Existing code that manually parsed or expected a simpler RTE JSON structure might require updates.
fix
Review the official documentation for SRTE and embedded items. Utilize `ContentstackUtils.json_to_html` with the `Options` class and a `render_embedded_object` callback for proper handling of embedded content in newer RTE fields.
affects: <1.1.0 to >1.1.0
breakingVersion 1.3.0 added 'Reference support', which could alter the structure of RTE JSON when entries contain linked references. If your application was making assumptions about RTE JSON structure, this might cause unexpected behavior.
fix
Ensure your code is resilient to changes in RTE JSON structure, particularly when dealing with references. Always validate the input to `json_to_html` or use the `Options` class to provide appropriate rendering logic for references.
affects: <1.3.0 to >1.3.0
gotchaSecurity fixes were implemented in versions 1.3.2 and 1.3.3. Older versions may contain unpatched vulnerabilities related to dependencies or parsing logic.
fix
Always upgrade to the latest stable version (currently 1.5.0) to ensure you have the most up-to-date security patches and bug fixes.
affects: <1.3.2
Upgrade
Version history
1.5.0latest on PyPI · released Apr 6, 2026
Audit
Dependencies
lxmlrequiredRequired for parsing and rendering HTML from Contentstack's Rich Text Editor JSON.
Agent activity
46 hits · last 30 days
node
40
OpenAI (training)
1
Resources