Skip to content

Commit bf2208d

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 bf2208d

6 files changed

Lines changed: 1096 additions & 1317 deletions

File tree

substack/__init__.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
"""A library that provides a Python interface to the Substack API."""
2-
3-
__author__ = "Paolo Mazza"
4-
__email__ = "mazzapaolo2019@gmail.com"
5-
__license__ = "MIT License"
6-
__version__ = "0.1.21"
7-
__url__ = "https://github.com/ma2za/python-substack"
8-
__download_url__ = "https://pypi.python.org/pypi/python-substack"
9-
__description__ = "A Python wrapper around the Substack API"
10-
11-
from .api import Api
1+
"""A library that provides a Python interface to the Substack API."""
2+
3+
__author__ = "Paolo Mazza"
4+
__email__ = "mazzapaolo2019@gmail.com"
5+
__license__ = "MIT License"
6+
__version__ = "0.1.21"
7+
__url__ = "https://github.com/ma2za/python-substack"
8+
__download_url__ = "https://pypi.python.org/pypi/python-substack"
9+
__description__ = "A Python wrapper around the Substack API"
10+
11+
from .api import Api
12+
from .models import Byline, PostMetadata, ScheduledRelease
13+
14+
__all__ = ["Api", "Byline", "PostMetadata", "ScheduledRelease"]

0 commit comments

Comments
 (0)