Repository navigation
feat: receive published blog articles - #2
Merged
Merged
Conversation
Verifies through fopost.webhooks.verify, answers 401 on a bad signature,
{"ok": true} for article.test and hands article.published to a callback
that may return the published URL. Raises the parent floor to fopost>=0.3;
CI installs the parent from its branch until that release is on PyPI.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
article_router(secret=..., on_article_published=...): anAPIRouterthe developer includes withapp.include_router(...). It readsawait request.body(), verifies through the parent'sfopost.webhooks.verify(X-FoPost-Signature-256overtimestamp.body, 300 s tolerance), answers 401 on a bad or stale signature,{"ok": true}forarticle.test, and handsarticle.publishedto the callback as a typedArticlePublishedPayload. The callback may be sync (run in a worker thread) or async, and a returned URL string is echoed as{"url": "..."}. Nothing else is registered.client.blogneeds no wrapper code:FoPostDepalready injects the parent client, sofopost.blog.*is reachable as-is. README mentions it.Parent pin
The parent
fopostgains the blog resource and verifier onfeature/blog-articles(fopost/fopost-python#32), unreleased.pyproject.tomlnow declaresfopost>=0.3,<1.0, and CI installs the parent from that git branch in a step beforepip install -e '.[dev]'. Oncefopost0.3 is on PyPI, drop that CI step; the floor already points at the release.Merge order: fopost-python#32, then release
fopost0.3, then this.How to verify
tests/test_articles.py: a signedarticle.testis accepted, a tamperedarticle.publishedis 401 and the callback never runs, a signedarticle.publishedreaches the callback parsed and its URL is echoed, a sync callback works.