API reference¶
Auto-generated from source docstrings and type hints.
Client¶
- class ogu_api.OGUClient(*, proxy=None, base_url=None, timeout_seconds=None, max_retries=None, retry_backoff_seconds=None, client_identifier=None, config=None, session=None)[source]¶
Bases:
objectThe top-level OGUsers client.
Aggregates 11 resource groups (
session,users,usercp,reputation,credits,messages,notifications,feed,threads,search,members) over a singletls_clientsession with Cloudflare-friendly TLS fingerprints.Use as an async context manager — the underlying session is closed on
__aexit__:>>> async with OGUClient() as client: ... await client.session.login('username', 'password') ... user = await client.users.get_by_username('forgivenforget')
- Parameters:
proxy (str | None) – Optional proxy string. Accepts
user:pass@host:port,host:port:user:pass, or plainhost:port; auto-normalized tohttp://....base_url (str | None) – Override the forum base URL (default
https://oguser.com).timeout_seconds (float | None) – Per-request timeout (default
30).max_retries (int | None) – How many times to retry on
429and5xx(default0).retry_backoff_seconds (float | None) – Base delay for exponential backoff (default
0.5).client_identifier (str | None) – TLS fingerprint identifier for
tls_client(default'chrome131').config (HttpClientConfig | None) – Provide a fully-built
HttpClientConfiginstead of the individual kwargs above.session (tls_client.Session | None) – Provide a pre-configured
tls_client.Session. The client will not close it automatically.
- session¶
Login / logout / login form.
- Type:
- users¶
Profile lookup.
- Type:
- usercp¶
Account settings.
- Type:
- reputation¶
Send reputation.
- Type:
- credits¶
Send / track credits.
- Type:
- messages¶
Private messages.
- Type:
- notifications¶
Notifications + alerts.
- Type:
- feed¶
Explore + home feeds.
- Type:
- threads¶
View threads / forums; reply; create.
- Type:
- search¶
Forum-wide search.
- Type:
- members¶
Member directory.
- Type:
- close()[source]¶
Close the underlying HTTP session.
Called automatically when used as an async context manager. Only closes the session if the client created it (i.e. you didn’t pass your own
sessionto__init__).- Return type:
None
- property http: HttpClient¶
The underlying
HttpClient. Use for endpoints not yet wrapped.
- property cookies: Any¶
The session cookie jar (
tls_client.Session.cookies).Iterable of
http.cookiejar.Cookieobjects. Use for persistence:>>> jar = {c.name: c.value for c in client.cookies}
HTTP layer¶
- class ogu_api.HttpClient(*, proxy=None, config=None, session=None)[source]¶
Bases:
objectAsync wrapper around
tls_client.Session.Runs the synchronous
tls_clientcalls in a worker thread viaasyncio.to_thread, applies retries on429/5xx, and maps HTTP status codes to typed exceptions fromogu_api.errors.You typically don’t construct this directly —
OGUClientdoes it for you. Drop down toclient.httpwhen you need to hit an endpoint not yet covered by a resource.- Parameters:
proxy (str | None) – Optional proxy string (see
Proxyfor accepted forms).config (HttpClientConfig | None) – Configuration.
Nonefor defaults.session (tls_client.Session | None) – Pre-configured
tls_client.Session. If provided, the client will not close it on shutdown.
- async get(path, *, query=None, extra_headers=None, allow_redirects=True)[source]¶
Convenience wrapper for
request('GET', ...).
- async post(path, *, data=None, json_body=None, query=None, extra_headers=None, allow_redirects=True)[source]¶
Convenience wrapper for
request('POST', ...).
- async request(method, path, *, query=None, data=None, json_body=None, extra_headers=None, allow_redirects=True)[source]¶
Issue an HTTP request through the underlying
tls_client.Session.- Parameters:
method (str) – HTTP verb (
'GET','POST', …).path (str) – Request path (relative to
base_url) or absolute URL.data (Mapping[str, Any] | None) – Form-urlencoded body for POST.
json_body (Any) – JSON body. Mutually exclusive with
data.extra_headers (Mapping[str, str] | None) – Per-request headers; merged on top of
HttpClientConfig.default_headers.allow_redirects (bool) – Follow 3xx redirects.
- Returns:
tls_client.response.Responsefor any 2xx / 3xx status.- Raises:
OGUValidationError – 400, 422.
OGUServerError – 5xx.
OGUTimeoutError – Request timed out.
OGUNetworkError – Other network-level failures.
- Return type:
Response
- class ogu_api.HttpClientConfig(base_url='https://oguser.com', timeout_seconds=30.0, max_retries=0, retry_backoff_seconds=0.5, client_identifier='chrome131', default_headers=<factory>)[source]¶
Bases:
objectFrozen configuration for
HttpClient.- Parameters:
- client_identifier¶
TLS fingerprint identifier passed to
tls_client.Session(default'chrome131').- Type:
- class ogu_api.Proxy(proxy=None)[source]¶
Bases:
objectNormalize proxy strings to the
http://...formtls_clientexpects.Accepts:
user:pass@host:port(standard URL form)host:port:user:pass(proxy-list form)host:port(no auth)
Existing scheme prefixes (
http://,socks5://, etc.) are stripped before matching; the result is alwayshttp://....- Parameters:
proxy (str | None) – Raw proxy string in any of the accepted forms.
Noneto disable.
- proxy¶
Normalized proxy URL, or
Nonewhen no input was provided or the input couldn’t be parsed.
Example
>>> Proxy('user:pass@host:8080').proxy 'http://user:pass@host:8080' >>> Proxy('host:8080:user:pass').proxy 'http://user:pass@host:8080' >>> Proxy('host:8080').proxy 'http://host:8080'
Models¶
- class ogu_api.UserProfile(user_id, username=None, reputation=0, vouches=0, credits=0)[source]¶
Bases:
objectParsed forum profile.
Returned by
UsersResource.get_by_username()andUsersResource.get_by_id(). Numeric fields default to0when the profile page doesn’t render them (e.g. brand-new accounts).
- class ogu_api.Inbox(messages=(), conversation_ids=(), my_post_key=None)[source]¶
Bases:
objectParsed inbox page.
Returned by
MessagesResource.inbox().my_post_keyis the form CSRF token used by every state-changing call across the SDK; you can cache it from a single inbox fetch and reuse across many sends.- Parameters:
- messages¶
Inbox rows (newest first).
- Type:
- class ogu_api.ThreadSummary(title, link, tid=None)[source]¶
Bases:
objectA thread reference extracted from a feed / forum / search page.
- link¶
URL path. Either
/showthread.php?tid=N&...(numeric) or/Thread-Slug-...(rewritten). Pass toThreadsResource.get_by_link()to fetch.- Type:
- class ogu_api.Thread(tid, title, posts, page=1, total_pages=1)[source]¶
Bases:
objectA parsed thread page.
Returned by
ThreadsResource.read(). Multi-page threads can be fetched one page at a time;pageandtotal_pagesreflect the current view.- title¶
Thread subject (best-effort: from the page
<title>tag, stripped of the trailing" | OGU"suffix).- Type:
- posts¶
Posts on the current page, in display order.
- Type:
- class ogu_api.Post(pid, author, author_id, body, date, date_label='', signature='')[source]¶
Bases:
objectA single post inside a thread.
- Parameters:
- author_id¶
Numeric user id of the poster, or
Noneif it couldn’t be recovered from the post header.- Type:
int | None
- date_label¶
Original date string from the page (
'Yesterday','2 hours ago','05-06-2026, 04:23 PM'etc.) for display.- Type:
- class ogu_api.RecentTransaction(sender, recipient, amount, date)[source]¶
Bases:
objectA row in the public
/credits.php?action=statsrecently-sent table.
Resources¶
- class ogu_api.resources.SessionResource(http_client)[source]¶
Bases:
ResourceBaseLogin, logout, and the public landing page.
Wraps
/member.php?action=login(form + submit) and/member.php?action=logout. The session cookie (ogusid) ends up on the client’s cookie jar after a successful login.- Parameters:
http_client (HttpClient)
- async get_home()[source]¶
Fetch the forum landing page (
/index.php).- Returns:
Raw response. Useful for sanity-checking the session (
len(response.text)should be substantial when logged in).- Return type:
Response
- async get_login_page()[source]¶
Fetch the login form page (
/member.php?action=login).- Returns:
Raw response. Pass
response.texttoextract_login_hidden()to recover the CSRF / hidden fields when callinglogin()manually.- Return type:
Response
- async login(username, password, two_factor='', *, hidden=None)[source]¶
Submit the login form and capture the session cookie.
When
hiddenis omitted, the SDK first GETs/member.php?action=loginand extracts the hidden fields itself, so most callers just pass username + password.- Parameters:
- Returns:
Raw POST response. The
ogusidsession cookie is set onclient.cookiesautomatically on success.- Return type:
Response
Example
>>> await client.session.login('username', 'password') >>> await client.session.login('username', 'password', '123456')
- async logout(logout_key=None)[source]¶
End the current session.
OGU’s logout requires a
logoutkeyquery parameter. When omitted, the SDK fetches the home page and extracts it from the logout link.- Parameters:
logout_key (str | None) – Pre-fetched key. Skips the extra round-trip when provided.
- Returns:
Raw GET response. The session cookies are invalidated server-side.
- Return type:
Response
- class ogu_api.resources.UsersResource(http_client)[source]¶
Bases:
ResourceBaseProfile lookup by username or numeric user id.
The high-level
get_by_*methods return aUserProfiledataclass with parsed integer fields. Theget_page_*variants return the rawtls_client.response.Responseso callers can feed the HTML to the staticextract_*parsers themselves.- Parameters:
http_client (HttpClient)
- async get_by_username(username)[source]¶
Fetch a user’s profile by username.
Hits the slug-rewritten URL
/{username}.- Parameters:
username (str) – Forum username (case-insensitive).
- Returns:
Parsed
UserProfile.- Raises:
OGUParseError – The page rendered, but no
user_idcould be extracted (usually a banned, deleted, or non-existent user).OGUNotFoundError – Profile page returned 404.
- Return type:
Example
>>> user = await client.users.get_by_username('forgivenforget') >>> print(user.user_id, user.credits, user.reputation)
- async get_by_id(user_id)[source]¶
Fetch a user’s profile by numeric user id.
Hits
/member.php?action=profile&uid={user_id}.- Parameters:
user_id (str | int) – Numeric user id (the value shown by
extract_user_id()).- Returns:
Parsed
UserProfile.- Raises:
OGUParseError – The page rendered, but no
user_idcould be extracted.- Return type:
- async get_page_by_username(username)[source]¶
Fetch the raw profile-page response by username (no parsing).
- Parameters:
username (str)
- Return type:
Response
- static extract_user_id(page_html)[source]¶
Pull the numeric user id from a profile page (text inside
#profileLink).
- static extract_username(page_html)[source]¶
Pull the canonical-cased username from
<span class="usernamefont">.
- static extract_reputation(page_html)[source]¶
Pull the positive-reputation count off a profile page (
'0'if absent).
- class ogu_api.resources.UserCPResource(http_client)[source]¶
Bases:
ResourceBaseUser Control Panel: account settings, profile, signature, credentials.
Every
update_*/change_*method auto-fetches its ownmy_post_keyfrom the corresponding form page when not provided. POSTs land on/usercp.phpwith the appropriateaction=do_*field.- Parameters:
http_client (HttpClient)
- async get_change_username_page()[source]¶
Fetch the change-username form page.
- Return type:
Response
- async get_change_password_page()[source]¶
Fetch the change-password form page.
- Return type:
Response
- async update_signature(signature, *, update_existing_posts='0', my_post_key=None)[source]¶
Update the forum signature.
- async update_options(options, *, my_post_key=None)[source]¶
Update the UserCP options form (notification prefs, theme, etc.).
- Parameters:
options (Mapping[str, Any]) – Mapping of form fields to values, e.g.
{'allownotices': '1', 'receivepms': '1', 'tpp': '20'}. Field names mirror the page’s<input name=...>attributes — fetchget_options_page()once to enumerate them.my_post_key (str | None) – Pre-fetched CSRF token.
- Return type:
Response
- async update_profile(fields, *, my_post_key=None)[source]¶
Update the profile-edit form (bio, custom fields, user title, …).
- async change_username(new_username, password, *, my_post_key=None)[source]¶
Change your forum username (subject to OGU’s cooldown rules).
- async change_password(old_password, new_password, *, my_post_key=None)[source]¶
Change your forum password.
- class ogu_api.resources.ReputationResource(http_client)[source]¶
Bases:
ResourceBaseSend reputation to a user.
Paths:
/reputation.php?action=add&uid={uid}&pid=0&modal=1— modal form./reputation.php?modal=1(POST) — submit.
- Parameters:
http_client (HttpClient)
- async get_page_response(user_id)[source]¶
Fetch the raw reputation modal for a target user (no parsing).
- async get_page(user_id)[source]¶
Fetch the reputation modal and return the parsed form data.
- Parameters:
- Returns:
ReputationPagewithvalues(allowed reputation amounts as strings, e.g.('-1', '0', '1')) andhidden(CSRF / form fields).- Return type:
Note
valuesis empty when the target won’t accept reputation from the current account (e.g. yourself, or someone you’ve already repped recently).
- async send(reputation, comment, uid='', *, hidden=None, validate=True)[source]¶
Submit a reputation rating.
When
hiddenis omitted, the SDK first loads the rep modal foruidto recover the form fields. Withvalidate=True(default), it also checks thatreputationappears in the modal’s allowed<select id="reputation">options before submitting.- Parameters:
reputation (int) –
-1,0, or1— depending on what the target’s modal allows.comment (str) – Comment attached to the rating.
hidden (Mapping[str, Any] | None) – Pre-fetched hidden form fields.
validate (bool) – Validate
reputationagainst the modal’s allowed values before posting. Set toFalseto skip the GET.
- Returns:
Raw POST response. The body containing
"Your reputation rating has successfully been added"indicates success.- Raises:
OGUReputationError –
validate=Trueandreputationis not in the target’s allowed values.- Return type:
Response
Example
>>> await client.reputation.send( ... reputation = 1, ... comment = 'good trade', ... uid = 12345, ... )
- class ogu_api.resources.CreditsResource(http_client)[source]¶
Bases:
ResourceBaseOGU credits: donate, send, and the public stats feed.
Paths:
/credits.php?action=donate— donate form./credits.php?action=stats— recently-sent stats./credits.php(POST) — submit donation. Requires a solved hCaptcha token; this SDK does not ship a solver.
- Parameters:
http_client (HttpClient)
- async get_stats_page()[source]¶
Fetch the credits stats page (raw HTML; recent transactions table).
- Return type:
Response
- async recently_sent()[source]¶
Parse the public “recently sent” feed.
- Returns:
Newest-first list of
RecentTransaction.dateis a UTC unix timestamp;0if the cell couldn’t be parsed.- Return type:
Example
>>> for tx in await client.credits.recently_sent(): ... print(f'{tx.sender} -> {tx.recipient}: {tx.amount}')
- async send(username, amount, captcha_token, reason='', *, hidden=None)[source]¶
Send credits to another user.
OGU requires a solved hCaptcha token on every donation; you must provide one. The hidden form fields (
donate_tokenand friends) are auto-fetched whenhiddenis omitted.- Parameters:
username (str) – Recipient username.
captcha_token (str) – A solved hCaptcha token, sent as both
g-recaptcha-responseandh-captcha-response.reason (str) – Optional message attached to the donation.
hidden (Mapping[str, Any] | None) – Pre-fetched hidden form fields. Skips the auto-fetch round-trip.
- Returns:
Raw POST response.
"You may close this page."in the body indicates success.- Return type:
Response
Example
>>> await client.credits.send( ... username = 'recipient', ... amount = 100, ... captcha_token = solved_token, ... )
Pull hidden inputs off the donate form (
form[action="credits.php"]).
- static extract_recently_sent(page_html)[source]¶
Parse the recently-sent transactions table.
- Parameters:
page_html (str) – HTML of
/credits.php?action=stats.- Returns:
Newest-first list of
RecentTransaction.- Return type:
- class ogu_api.resources.MessagesResource(http_client)[source]¶
Bases:
ResourceBasePrivate messages: inbox, conversations, compose, send, delete.
Maps to
/private.phpand (the alias)/messages. Paths used:/private.php— inbox listing./private.php?action=send— compose form./private.php?action=read&convid={id}— single conversation./private.php?action=tracking— tracking (sent / read receipts)./private.php(POST,action=do_send) — send./private.php(POST,action=do_stuff) — bulk delete.
- Parameters:
http_client (HttpClient)
- async get_inbox(*, page=None)[source]¶
Fetch the raw inbox page.
- Parameters:
page (int | None) – 1-indexed pagination page.
Nonefor the first page.- Returns:
Raw response. Pass
response.texttoextract_messages()andextract_conversation_ids(), or useinbox()to get anInboxdataclass directly.- Return type:
Response
- async inbox(*, page=None)[source]¶
Fetch and parse the inbox page.
- Parameters:
page (int | None) – 1-indexed pagination page.
- Returns:
Inboxwithmessages,conversation_ids, andmy_post_key.my_post_keyis the form CSRF token used by every state-changing call across the SDK; you can pass it through to subsequentsend/deletecalls to skip an extra round-trip.- Return type:
Example
>>> inbox = await client.messages.inbox() >>> for m in inbox.messages: ... print(m.username, m.message)
- async get_compose_page()[source]¶
Fetch the compose form (
/private.php?action=send).- Return type:
Response
- async get_conversation(conversation_id)[source]¶
Fetch a single conversation thread by id.
- Parameters:
conversation_id (str) – The opaque
convidfromextract_conversation_ids()orInbox.conversation_ids.- Return type:
Response
- async get_tracking()[source]¶
Fetch the message-tracking page (sent / read receipts).
- Return type:
Response
- async send(to, message, *, my_post_key=None, hidden=None)[source]¶
Send a private message.
When
my_post_keyandhiddenare omitted, the SDK first GETs the compose page to recover them, then POSTs the message.- Parameters:
- Returns:
Raw POST response. A 200 with the inbox layout indicates success.
- Return type:
Response
Example
>>> await client.messages.send(to = 'recipient', message = 'hello') >>> # Reuse the key when sending many at once >>> inbox = await client.messages.inbox() >>> for r in recipients: ... await client.messages.send(to = r, message = 'hi', my_post_key = inbox.my_post_key)
- async delete(message_hashes, *, my_post_key=None)[source]¶
Bulk-delete messages by hash.
Each row in the inbox table has a
toDelete[<hash>]checkbox; thehashis an opaque per-message id that you’d extract from the inbox page yourself if you need fine control.
Pull hidden inputs off the compose form (
form[action="private.php"]).
- class ogu_api.resources.NotificationsResource(http_client)[source]¶
Bases:
ResourceBaseSite notifications and the alerts dropdown.
Paths:
/notifications— full notifications page./alerts.php— alerts page./alerts.php?action=read— mark all alerts read.
- Parameters:
http_client (HttpClient)
- async mark_alerts_read()[source]¶
Mark every alert as read (
/alerts.php?action=read).- Return type:
Response
- class ogu_api.resources.FeedResource(http_client)[source]¶
Bases:
ResourceBaseForum landing pages: explore (marketplace) and home.
Paths:
/explore.php— marketplace landing (slug-rewritten URLs)./index.php— home / activity feed (numeric tid URLs).
Most callers want
explore()andhome()(parsedThreadSummarylists). Theget_*andextract_*methods are escape hatches.- Parameters:
http_client (HttpClient)
- async explore()[source]¶
Parsed explore feed.
- Returns:
List of
ThreadSummary.linkis the slug-rewritten path (/Thread-...).tidisNonefor entries whose only link form is slug-only.- Return type:
- async home()[source]¶
Parsed home feed.
- Returns:
List of
ThreadSummaryfor every thread on/index.php. The “last post” jump-link in each row is merged with the title link, so each thread appears exactly once.- Return type:
- static extract_thread_summaries(page_html)[source]¶
Walk every thread anchor in the page and collapse rows into summaries.
Title links (
/Thread-Slug) and “last post” jump-links (/showthread.php?tid=N&action=lastpost) for the same thread are merged into oneThreadSummaryby looking for a sibling tid anchor in the same<tr>row when the current anchor has no tid of its own.- Parameters:
page_html (str) – HTML of any page containing thread links — explore, home,
/forumdisplay.php?fid=..., search results, etc.- Returns:
One
ThreadSummaryper unique thread, in document order.- Return type:
- static extract_thread_links(page_html)[source]¶
Return deduped thread URL paths in document order.
Catches both
/showthread.php?tid=Nand/Thread-Slugforms. Use this when you don’t need titles —extract_thread_summaries()gives you titles + tid for free.
- class ogu_api.resources.ThreadsResource(http_client)[source]¶
Bases:
ResourceBaseView threads / forums and post replies and new threads.
Paths:
/showthread.php?tid={tid}— read a thread./forumdisplay.php?fid={fid}— read a forum’s thread list./newreply.php?tid={tid}— reply form./newreply.php?tid={tid}&processed=1(POST) — submit reply./newthread.php?fid={fid}— new-thread form./newthread.php?fid={fid}&processed=1(POST) — submit new thread.
- Parameters:
http_client (HttpClient)
- async read(thread_id, *, page=None)[source]¶
Fetch and parse a thread page into a
Threaddataclass.Each post becomes a
Postwithpid,author,author_id,body,date(UTC unix timestamp), and the originaldate_labelfrom the page.- Parameters:
- Returns:
Parsed
Thread.- Return type:
Example
>>> thread = await client.threads.read(1286827) >>> print(thread.title, thread.page, thread.total_pages) >>> for post in thread.posts: ... print(post.author, post.date_label, post.body[:80])
- async get_by_link(link)[source]¶
Fetch a thread by an arbitrary link (numeric or slug-rewritten).
- Parameters:
link (str) – Path returned by
FeedResource.extract_thread_links(), e.g./Thread-Card-to-Cryptoor/showthread.php?tid=123&action=lastpost.- Return type:
Response
- async reply(thread_id, message, *, my_post_key=None, hidden=None)[source]¶
Post a reply to a thread.
Auto-fetches the reply form when
hiddenis omitted, so the common case is justawait client.threads.reply(tid, message).- Parameters:
- Returns:
Raw POST response.
- Return type:
Response
Example
>>> await client.threads.reply(1286827, 'great post')
- async create(forum_id, subject, message, *, my_post_key=None, hidden=None)[source]¶
Create a new thread in a forum.
- Parameters:
- Returns:
Raw POST response.
- Return type:
Response
Example
>>> await client.threads.create(13, subject = 'hi', message = 'first post')
- classmethod parse(page_html, *, thread_id, page=1)[source]¶
Parse a
/showthread.phppage into aThread.
Pull hidden inputs off the reply form (
form[action*="newreply.php"]).
- class ogu_api.resources.SearchResource(http_client)[source]¶
Bases:
ResourceBaseForum-wide search and the lookup form.
Paths:
/search.php(GET) — search form./search.php(POST,action=do_search) — submit search./search.php?action=results&sid={id}— paginated results page./lookup.php— quick username lookup form.
- Parameters:
http_client (HttpClient)
- async search(keywords, *, author='', forums=None, find_thread_starters_only=False, match_username_exactly=False, post_or_thread='thread', post_date='', post_date_direction='older', sort_by='lastpost', sort_direction='desc', show_results='threads')[source]¶
Submit a search query.
- Parameters:
keywords (str) – Search keywords.
author (str) – Filter by post author.
forums (list[str] | None) – List of forum ids (
fid) to scope to.find_thread_starters_only (bool) – Only match the first post of each thread (i.e. thread starters).
match_username_exactly (bool) – Treat
authoras an exact match instead of substring.post_or_thread (str) –
'thread'or'post'.post_date (str) – Date filter (e.g.
'7'for last 7 days).post_date_direction (str) –
'older'or'newer'.sort_by (str) –
'lastpost','subject','replies', etc.sort_direction (str) –
'asc'or'desc'.show_results (str) –
'threads'or'posts'.
- Returns:
Raw POST response — usually a redirect to
/search.php?action=results&sid=....- Return type:
Response
- class ogu_api.resources.MembersResource(http_client)[source]¶
Bases:
ResourceBaseMember browsing: list, top, team, groups, vouches, awards, rep history.
All methods return the raw page response — parse the HTML yourself with BeautifulSoup or feed it to the parsers in
ogu_api.resources.userswhen you only need profile fields.- Parameters:
http_client (HttpClient)
- async list(*, username='', username_match='contains', sort='username', order='asc', page=None, per_page=None)[source]¶
Fetch the paginated member list.
- Parameters:
username (str) – Filter by username substring (or exact, see
username_match).username_match (str) –
'contains','begins','ends', or'exact'.sort (str) – Sort key —
'username','regdate','lastvisit','postnum'.order (str) –
'asc'or'desc'.page (int | None) – 1-indexed pagination page.
per_page (int | None) – Members per page.
- Return type:
Response
- async statistics()[source]¶
Fetch the forum statistics page (
/statistics.php).- Return type:
Response
Errors¶
- exception ogu_api.errors.OGUError[source]¶
Bases:
ExceptionBase class for every exception raised by
ogu-api.Catch this when you want to handle anything the SDK might throw.
- exception ogu_api.errors.OGUAPIError(message, *, status_code, method, url, body=None)[source]¶
Bases:
OGUErrorHTTP error response from the forum (4xx / 5xx).
Subclassed by status-code-specific errors (
OGUNotFoundError, etc.). The exact subclass is chosen byHttpClientbased on the status.- Parameters:
- Return type:
None
- status_code¶
HTTP status code.
- method¶
HTTP method used (
'GET','POST', …).
- url¶
Full URL of the failing request.
- body¶
Response body, if available, for inspection.
- exception ogu_api.errors.OGUAuthenticationError(message, *, status_code, method, url, body=None)[source]¶
Bases:
OGUAPIErrorHTTP 401: missing or invalid session cookie.
- exception ogu_api.errors.OGUAuthorizationError(message, *, status_code, method, url, body=None)[source]¶
Bases:
OGUAPIErrorHTTP 403: session is valid but the action isn’t permitted.
- exception ogu_api.errors.OGUNotFoundError(message, *, status_code, method, url, body=None)[source]¶
Bases:
OGUAPIErrorHTTP 404: resource (profile, thread, page) not found.
- exception ogu_api.errors.OGUValidationError(message, *, status_code, method, url, body=None)[source]¶
Bases:
OGUAPIErrorHTTP 400 / 422: form or query parameters were rejected.
- exception ogu_api.errors.OGURateLimitError(message, *, status_code, method, url, body=None, retry_after_seconds=None)[source]¶
Bases:
OGUAPIErrorHTTP 429: rate-limited by the forum or fronting CDN.
- Parameters:
- Return type:
None
- retry_after_seconds¶
Retry-Afterheader value when present, elseNone. The HTTP layer honors this automatically when retries are configured.
- exception ogu_api.errors.OGUServerError(message, *, status_code, method, url, body=None)[source]¶
Bases:
OGUAPIErrorHTTP 5xx: forum or upstream returned a server error.
- exception ogu_api.errors.OGUNetworkError[source]¶
Bases:
OGUErrorNetwork-level failure: connection refused, DNS error, TLS handshake, etc.
- exception ogu_api.errors.OGUTimeoutError[source]¶
Bases:
OGUNetworkErrorRequest exceeded
HttpClientConfig.timeout_seconds.
- exception ogu_api.errors.OGUParseError(message='Failed to parse response')[source]¶
Bases:
OGUErrorA page came back, but expected HTML structure was missing.
Raised when an extractor needed a specific element that wasn’t present — e.g. profile pages without
#profileLink.- Parameters:
message (str)
- Return type:
None
- exception ogu_api.errors.OGUSessionError(message='Session is invalid or expired')[source]¶
Bases:
OGUErrorThe session cookie is missing or has expired.
Raised by helpers that depend on a logged-in session.
- Parameters:
message (str)
- Return type:
None
- exception ogu_api.errors.OGULoginError(message='Login failed')[source]¶
Bases:
OGUErrorLogin flow returned an error indicator from the forum.
- Parameters:
message (str)
- Return type:
None
- exception ogu_api.errors.OGUReputationError(message='Reputation request failed', *, valid_amounts=None)[source]¶
Bases:
OGUErrorThe forum rejected a reputation submission.
Most commonly raised when the value passed to
ReputationResource.send()isn’t in the target user’s allowed options.- valid_amounts¶
List of allowed reputation values returned by the target’s modal, or
Nonewhen not available.