Skip to main content

Async Python wrapper for the OGUsers (oguser.com) forum.

Project description

ogu-api

PyPI Docs Python

An async Python wrapper for the OGUsers forum.

Wraps the public-facing pages and forms; login, profile lookup, reputation, credits, private messages, feed, threads, notifications, member search, account control panel, with a typed, async-first client.

Full documentation: https://ogu-api.readthedocs.io.

Install

pip install ogu-api

Requires Python 3.11+.

Quick start

import asyncio

from ogu_api import OGUClient


async def main() -> None:
    async with OGUClient() as client:
        await client.session.login('username', 'password')

        user = await client.users.get_by_username('forgivenforget')
        print(user.username, user.credits, user.reputation, user.vouches)


asyncio.run(main())

Resources

Resource What it covers
client.session login page, login, logout
client.users profile lookup by username or uid; returns UserProfile (id, username, reputation, vouches, credits)
client.usercp notepad, signature, options, profile, change username/password/email
client.reputation reputation page, send reputation
client.credits donate page, stats page, send credits, parse recently-sent transactions
client.messages PM inbox, conversation, compose, send, tracking, delete
client.notifications notifications page, alerts, mark alerts read
client.feed explore feed, home feed, thread-id extraction
client.threads view thread, view forum, reply, create thread
client.search full-text search form + post
client.members member list, top, statistics, team, groups, vouches, awards, reputation history

Inbox & PMs

inbox = await client.messages.inbox()

for m in inbox.messages:
    print(m.username, m.message)

await client.messages.send(to = 'recipient', message = 'hello')

Inbox is a dataclass with messages: tuple[Message, ...], conversation_ids: tuple[str, ...], and my_post_key.

Every state-changing call in the SDK auto-fetches its own my_post_key and form hidden fields when you don't pass them. To skip the extra round-trip, pass them explicitly:

await client.messages.send(
    to = 'recipient',
    message = 'hello',
    my_post_key = inbox.my_post_key,
)

Read the feed

for thread in await client.feed.explore():
    print(thread.title, thread.link, thread.tid)

for thread in await client.feed.home():
    print(thread.title, thread.tid)

feed.explore() and feed.home() return list[ThreadSummary] with title, link, and tid (numeric, or None for slug-rewritten URLs that don't carry one). For raw HTML access, use get_explore() / get_home().

Reply to a thread

await client.threads.reply(tid, message = 'great post')

Persist a session

ogu-api doesn't store credentials. After login, the session lives on the client's cookie jar — serialize it however you like:

cookies = {cookie.name: cookie.value for cookie in client.cookies}

To resume a session, pre-seed the cookies on a fresh client:

client = OGUClient()

for name, value in cookies.items():
    client.cookies.set(name, value)

Configuration

client = OGUClient(
    proxy = 'user:pass@host:8080',
    timeout_seconds = 30.0,
    max_retries = 3,
    retry_backoff_seconds = 0.5,
    client_identifier = 'chrome131',
)

Proxy strings accept user:pass@host:port, host:port:user:pass, or plain host:port and are normalized to http://... for the underlying tls_client session.

Errors

from ogu_api import OGUNotFoundError, OGURateLimitError

try:
    await client.users.get_by_username('does-not-exist')

except OGUNotFoundError as E:
    print('not found:', E.url)

except OGURateLimitError as E:
    print('rate limited, retry after', E.retry_after_seconds)

Full hierarchy:

  • OGUError
    • OGUAPIErrorOGUAuthenticationError, OGUAuthorizationError, OGUNotFoundError, OGUValidationError, OGURateLimitError, OGUServerError
    • OGUNetworkErrorOGUTimeoutError
    • OGUParseError, OGUSessionError, OGULoginError, OGUReputationError, OGUCreditsError

Captcha

Sending credits requires an hCaptcha token. ogu-api doesn't ship a solver — pass a pre-solved token in:

await client.credits.send(
    username = 'recipient',
    amount = 100,
    captcha_token = solved_token,
)

Features

  • Async-first — every request is async, backed by tls_client on a worker thread for Cloudflare-friendly TLS fingerprints
  • Typedfrom __future__ import annotations everywhere, py.typed marker, dataclass models for parsed payloads
  • Resource-oriented — calls grouped under client.session, client.users, client.messages, etc.
  • Typed errors — full exception hierarchy mapped from HTTP status codes
  • Retries — exponential backoff on 429 and 5xx, honors Retry-After
  • Proxies — string-form proxies auto-normalized

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

ogu_api-0.6.0.tar.gz (26.4 kB view details)

Uploaded Source

Built Distribution

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

ogu_api-0.6.0-py3-none-any.whl (37.6 kB view details)

Uploaded Python 3

File details

Details for the file ogu_api-0.6.0.tar.gz.

File metadata

  • Download URL: ogu_api-0.6.0.tar.gz
  • Upload date:
  • Size: 26.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ogu_api-0.6.0.tar.gz
Algorithm Hash digest
SHA256 e00b8f9105a26ac2d08fa8ec755325a40e7ba2852edf72b231cb5f4db70b2902
MD5 d30e93246892239fda11ef015e3bad16
BLAKE2b-256 dd4058a69d43f2c3d0af589815d0f8fc79406480058c8965ed427fd9377fba82

See more details on using hashes here.

Provenance

The following attestation bundles were made for ogu_api-0.6.0.tar.gz:

Publisher: publish.yml on forgivenforget/ogu-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ogu_api-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: ogu_api-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 37.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ogu_api-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 66ae0933bb17db7a7a852ad3c165c2776f6f30769e4565471b798b9278f5d7bb
MD5 e823ff50a50e874c7d1b993b9a8176e0
BLAKE2b-256 c92e29c0d4c6f2183c1bb9d7249d8c81a5d0e67ce00122c5307889f0baf9a1d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for ogu_api-0.6.0-py3-none-any.whl:

Publisher: publish.yml on forgivenforget/ogu-api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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