Skip to content

Commit 84edaa5

Browse files
svaningelgemclaude
andcommitted
feat: add models module, API helpers, and Post refactoring
- Add models.py with Byline, PostMetadata, ScheduledRelease dataclasses - Add schedule_release(), get_post_metadata(), make_post_free() to Api - Extract _authenticate() and _resolve_publication() from __init__ - Add _get/_post/_put/_delete HTTP helpers, refactor all methods to use them - Add _handle_response allow_empty param with proper error chaining - Add _PRODUCTION_SUBDOMAINS safety guard - publish_draft now auto-runs prepublish validation - Use pathlib.Path instead of os.path/open for file operations - Post: dispatch table _ADD_HANDLERS replaces if/elif chain - Post: add paywall() and add_subscribe_button() methods - Post: extract _parse_markdown_blocks, _upload_or_passthrough, _render_image - Post: code_block uses match/case, _process_line handles inline headings - Refactored from_markdown() with HR support and better line merging - MCP: remove separate prepublish_draft tool (now automatic) - Add type annotations throughout all modules Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e659a9e commit 84edaa5

6 files changed

Lines changed: 829 additions & 1050 deletions

File tree

substack/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@
99
__description__ = "A Python wrapper around the Substack API"
1010

1111
from .api import Api
12+
from .models import Byline, PostMetadata, ScheduledRelease
13+
14+
__all__ = ["Api", "Byline", "PostMetadata", "ScheduledRelease"]

0 commit comments

Comments
 (0)