zapostit-api
typed python client for zapostit.com with sync and async apis
it reads authors, posts, comments, replies, polls and media links. authenticated sessions can create comments, reply, toggle reactions and delete their own comments
installation
python 3.11 or newer is required
pip install "zapostit-api @ git+ssh://git@github.com/yar2slav/zapostit-api.git@v0.2.0"
local editable install:
git clone git@github.com:yar2slav/zapostit-api.git
cd zapostit-api
pip install -e ".[dev]"
basic usage
from zapostit import Zapostit
with Zapostit() as api:
author = api.get_author("slivach")
print(author.name, api.get_post_count(author.id))
for post in api.iter_posts(author.slug, max_posts=20):
print(post.created_at, post.url)
print(post.text_with_links)
for media in post.media:
print(media.kind, media.url)
post.text contains the original text. post.text_with_links shows hidden hyperlink targets next to the linked text
pages and search
page = api.get_posts_page("slivach", limit=10)
for post in page.items:
print(post.id)
next_page = api.get_posts_page(
"slivach",
cursor=page.next_cursor,
limit=10,
)
iter_posts() handles cursors and duplicate ids automatically
for post in api.search_posts("pozdnyakov", "Черногория"):
print(post.url, post.text_with_links)
comments
for comment in api.iter_comments(post_id=104459, sort="newest"):
print(comment.author.name, comment.text_with_links)
comments can also be returned as a tree:
threads = api.get_comment_threads(104459)
for thread in threads:
print(thread.comment.text)
for reply in thread.replies:
print(" ", reply.comment.text)
media
the library returns public urls and metadata without downloading files
for media in post.media:
print(media.kind, media.url, media.thumbnail_url)
for variant in media.variants:
print(variant.type, variant.width, variant.height, variant.url)
photos, albums, videos, voice messages, audio, documents and polls are supported
polling
with Zapostit() as api:
for post in api.watch_posts("slivach", interval=30):
print("new post:", post.url)
the first request creates a baseline. pass emit_existing=True to receive the current first page immediately
authenticated actions
an existing session token can be passed through an environment variable:
import os
from zapostit import Zapostit
with Zapostit(session_token=os.environ["ZAPOSTIT_SESSION_TOKEN"]) as api:
print(api.get_session().user.login)
comment = api.create_comment(104459, "hello")
reply = api.reply_to_comment(104459, comment.id, "reply")
api.toggle_reaction(104459, "post", emoji_id=6)
api.toggle_reaction(comment.id, "comment", emoji_id=0)
api.delete_comment(reply.id)
mutation requests are sent once and are not retried automatically
async usage
AsyncZapostit has the same method names. iterators become async iterators
import asyncio
from zapostit import AsyncZapostit
async def main() -> None:
async with AsyncZapostit() as api:
async for post in api.iter_posts("slivach", max_posts=20):
print(post.url)
asyncio.run(main())
main methods
get_authors(),get_author(),get_post_count()get_posts_page(),iter_posts(),search_posts(),iter_all_posts()get_comments_page(),get_replies_page(),iter_comments()get_comment_threads(),get_poll_results()watch_posts()login(),get_session()create_comment(),reply_to_comment(),delete_comment()toggle_reaction()
models are frozen pydantic models. use model_dump() or model_dump_json() for serialization. unknown upstream fields are kept in raw
errors
all library errors inherit from ZapostitError
ApiErrorAuthenticationErrorRateLimitErrorDecodeErrorNotFoundError
read requests use bounded retries for network errors, 429 and 5xx responses
development
ruff format --check src
ruff check src
mypy --strict src/zapostit
license
mit. commercial use, modification, distribution, sublicensing and private use are allowed
Metadata
Release files for zapostit-api 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| zapostit_api-0.2.0.tar.gz | 26.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| zapostit_api-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 55.2 kB
Release files / zapostit_api-0.2.0.tar.gz
| Download URL | zapostit_api-0.2.0.tar.gz |
|---|---|
| Size | 26.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
29231cfa1e5931110f7fe5b60147bf9561d034bea73c3abe547d7d1a319329f1
|
|
BLAKE2b-256 checksum How to use checksums |
15a6296055b3209c51b5d5cc6b332af56633786d19f95864a91f88a54a983107
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.
Transparency logRelease files / zapostit_api-0.2.0-py3-none-any.whl
| Download URL | zapostit_api-0.2.0-py3-none-any.whl |
|---|---|
| Size | 28.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a8439fdd1a6994c8fb4cdd0ee82033f2512dd23ce4d0e869977290cc49912dda
|
|
BLAKE2b-256 checksum How to use checksums |
6053a1d1f4348f965b79cdf2827003b42167b73fa9437ff7c842a020afbbf61a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 16, 2026.
Transparency log