Models
airvpn.web.forum.models
Category
A top-level grouping of forums, fetched and cached on first access.
Attributes:
| Name | Type | Description |
|---|---|---|
session |
WebSession
|
The session used to fetch related resources. |
title |
str
|
The category's title. |
url |
str
|
The category's URL. |
forums |
list[Forum]
|
The forums in this category, fetched and cached lazily on first access. |
forums: list[Forum]
property
The forums in this category, fetching them on first access if not already loaded.
update(forums: Optional[list] = None)
Parse and (re)populate self.forums.
If forums (a list of forum
Comment
A single reply/post within a forum topic.
Attributes:
| Name | Type | Description |
|---|---|---|
user |
WebUser
|
The author of the comment. |
id |
int
|
The comment's unique content-comment id. |
content |
str
|
The comment's HTML content. |
Forum
A forum section, with lazily-paginated access to its topics and any sub-forums.
Attributes:
| Name | Type | Description |
|---|---|---|
session |
WebSession
|
The session used to fetch related resources. |
title |
str
|
The forum's title. |
url |
str
|
The forum's URL. |
description |
Optional[str]
|
The forum's description, if any. |
sub_forums |
list[Forum]
|
Any child forums nested under this one. |
pages |
ForumPagination
|
Lazily-loaded, paginated access to the forum's topics. |
ForumPagination
Bases: BasePagination[Topic]
Lazily fetches and caches pages of topics for a forum.
Attributes:
| Name | Type | Description |
|---|---|---|
session |
WebSession
|
The session used to fetch pages. |
url |
str
|
The forum's base URL (inherited from BasePagination). |
pages |
dict[int, list[Topic]]
|
Cache of fetched pages, keyed by 0-indexed page number (inherited from BasePagination). |
__init__(session: WebSession, url: str)
Initialize pagination bound to a forum URL.
update(page: int = 1)
Fetch page (1-indexed) from the forum and store parsed topics as self.pages[page - 1].
Raises IndexError if page doesn't exist (the forum redirects back to its base URL).
Topic
A single forum topic/thread, with lazily-paginated access to its comments.
Attributes:
| Name | Type | Description |
|---|---|---|
session |
WebSession
|
The session used to fetch related resources. |
user |
WebUser
|
The user who started the topic. |
id |
int
|
The topic's unique id. |
url |
str
|
The topic's URL. |
title |
str
|
The topic's title. |
reply_count |
int
|
The number of replies in the topic. |
views |
int
|
The number of views the topic has received. |
max_page |
int
|
The total number of comment pages in the topic. |
pages |
TopicPagination
|
Lazily-loaded, paginated access to the topic's comments. |
TopicPagination
Bases: BasePagination[Comment]
Lazily fetches and caches pages of comments for a forum topic.
Attributes:
| Name | Type | Description |
|---|---|---|
session |
WebSession
|
The session used to fetch pages. |
max_page |
int
|
The total number of pages available for this topic. |
url |
str
|
The topic's base URL (inherited from BasePagination). |
pages |
dict[int, list[Comment]]
|
Cache of fetched pages, keyed by 0-indexed page number (inherited from BasePagination). |
__init__(session: WebSession, url: str, max_page: int)
Initialize pagination bound to a topic URL and its known max page count.
update(page: int = 1)
Fetch page (1-indexed) from the topic and store parsed comments as self.pages[page - 1].
Raises IndexError if page is at or beyond self.max_page.