Python SDK
Add an EarlySEO blog to your Django or Flask app with the earlyseo-blog Python package. Overview, installation, CLI scaffold, and standalone client.
Overview
The earlyseo-blog Python package lets you render EarlySEO articles in Django, Flask, or any Python application. Articles are authored in the EarlySEO dashboard and fetched at runtime by the package.
Quick Start with CLI
The fastest way to get started — the CLI detects your framework and scaffolds everything:
pip install earlyseo-blog
earlyseo-blogThe CLI will:
- Detect your framework (Django or Flask)
- Ask for your Site ID (from Dashboard → Integrations → SDK)
- Generate starter templates, config, and a
.envfile
Framework Guides
For step-by-step setup instructions, follow the guide for your framework:
| Framework | Guide | Install |
|---|---|---|
| Django | Django SDK Guide | pip install "earlyseo-blog[django]" |
| Flask | Flask SDK Guide | pip install "earlyseo-blog[flask]" |
Prerequisites
- Python ≥ 3.9
- An EarlySEO account with at least one published article
- SDK integration enabled (Dashboard → Integrations → SDK)
- Site ID from the SDK integration card
Installation
# Core package (standalone client only)
pip install earlyseo-blog
# With Django support
pip install "earlyseo-blog[django]"
# With Flask support
pip install "earlyseo-blog[flask]"
# With async HTTP/2 support
pip install "earlyseo-blog[async]"Standalone Client
Use the client directly in any Python code — scripts, APIs, data pipelines, or microservices:
from earlyseo_blog import EarlySeoClient
client = EarlySeoClient(site_id="your-site-id")
# Paginated article list
page = client.get_list_page(1)
for item in page.articles:
print(item.title, item.slug)
# Full article with HTML content
article = client.get_article("my-slug")
print(article.content_html)Async Client
For high-throughput or async frameworks (FastAPI, Starlette, Quart):
from earlyseo_blog import AsyncEarlySeoClient
async with AsyncEarlySeoClient(site_id="your-site-id") as client:
page = await client.get_list_page(1)
article = await client.get_article("my-slug")Install the async extra for HTTP/2 support:
pip install "earlyseo-blog[async]"Configuration Reference
| Setting | Description | Default |
|---|---|---|
site_id | Your EarlySEO site ID (required) | — |
Django: Set EARLYSEO_SITE_ID in settings.py.
Flask: Set app.config["EARLYSEO_SITE_ID"].
Data Models
All API responses are validated with Pydantic v2:
| Model | Description |
|---|---|
Manifest | Site manifest — total pages and article count |
ArticleListItem | Article summary for list views (title, slug, meta_description, featured_image_url) |
ArticleListPage | Paginated list of ArticleListItem with page metadata |
Article | Full article including content_html, SEO fields, and metadata |
from earlyseo_blog.models import Article, Manifest, ArticleListPageHow Publishing Works
- Write and publish an article in the EarlySEO dashboard
- Article data becomes instantly available
- Your Python app fetches the data at request time
- Articles include SEO metadata automatically