Skip to main content

Python SDK for the Visibly Content Autopilot API - Pull API client, HMAC webhook verification, and Flask Blueprint.

Project description

ai-content-autopilot

Python SDK for the Visibly Content Autopilot API. Provides a Pull API client, HMAC-SHA256 webhook verification, and a Flask Blueprint for receiving webhooks.

Installation

pip install ai-content-autopilot

Quick Start

Option A: Full Flask Blueprint (webhook receiver + auto-fetch)

from ai_content_autopilot import configure_visibly, contentpilot_webhook_bp

def my_handler(article):
    """Called when a webhook delivers an article."""
    print(article['title'], article['content_html'])
    return True

configure_visibly(
    webhook_secret='your-webhook-secret',
    api_key='sk_live_your_api_key',
    on_article_received=my_handler,
)

app.register_blueprint(contentpilot_webhook_bp)
# POST /webhooks/visibly is now active

Option B: Standalone Pull API Client

from ai_content_autopilot import VisiblyClient

client = VisiblyClient(api_key='sk_live_your_api_key')

# List approved articles
articles = client.list_articles(status='approved', project_id=5)

# Fetch single article with full content
article = client.fetch_article(42, include_markdown=True)

# Confirm publication
client.confirm_published(42, 'https://myblog.com/seo-guide')

Option C: HMAC verification only

from ai_content_autopilot import verify_webhook_signature

is_valid = verify_webhook_signature(
    payload_bytes=request.get_data(),
    secret='your-webhook-secret',
    signature_header=request.headers.get('X-Webhook-Signature', ''),
)

API Reference

Function / Class Description
configure_visibly(webhook_secret, api_key, base_url, on_article_received) Configure the Blueprint with credentials and callback
verify_webhook_signature(payload_bytes, secret, signature_header) Verify HMAC-SHA256 signature. Returns True/False
VisiblyClient(api_key, base_url, timeout) Pull API client for fetching, listing, and confirming articles
client.fetch_article(article_id, include_markdown) Returns article dict or None
client.list_articles(status, project_id, limit, offset) Returns list of article dicts
client.confirm_published(article_id, published_url) Confirms publication. Returns True/False
contentpilot_webhook_bp Flask Blueprint. Register with app.register_blueprint()
default_flask_blog_handler(article) Default handler: saves article as JSON to ./content_output/

Development

pip install -e ".[dev]"
pytest tests/ -v

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_content_autopilot-1.0.0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ai_content_autopilot-1.0.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file ai_content_autopilot-1.0.0.tar.gz.

File metadata

  • Download URL: ai_content_autopilot-1.0.0.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for ai_content_autopilot-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3941c410d63477364a705ab2cc1ca31c62094053dca18cd1944f44fe9f1c9e90
MD5 fdffb0896a0c8e853bb6c77742b5a81b
BLAKE2b-256 320e2d86648483e2ef06e4a7d7f807e7d7d42332b3d516bab53f9d576f2c2386

See more details on using hashes here.

File details

Details for the file ai_content_autopilot-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ai_content_autopilot-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 81d62116a49b90c8b73b20f481bb92345eded24fea560c8139f1edc90b41581a
MD5 b29a99bd35a39a48fa3cf5e0cea5dec9
BLAKE2b-256 9fa53dd6efb2b4818be189713447424a2d9398ad1bf3d7656b1a401919e254f2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page