Class Client
File: Base/Client.py
Description: Handles authentication and API requests for a single user. Initializes forum and group managers.
Properties:
- baseurl: str
- headers: dict
- token: str
- ClientRequests: ClientRequests
- Forum: ForumManager
- GroupManager: GroupManager
Methods:
__init__(email, password)
Authenticate user, set up headers, token, and managers. Raises TokenInvalidError if login fails.
References: TokenInvalidError, ClientRequests, ForumManager, GroupManager
post(url, payload)
Send a POST request to the WRTS API.
Class ClientAuth
File: Base/ClientAuth.py
Description: Handles authentication, including CAPTCHA solving if required.
Properties:
- baseurl: str
- headers: dict
- token: str
Methods:
__init__(email, password)
Authenticate user, solve CAPTCHA if needed, set up headers and token. Raises TokenInvalidError if login fails.
References: TokenInvalidError, solve
post(url, payload)
Send a POST request to the WRTS API.
Class ClientCluster
File: Base/ClientCluster.py
Description: Manages multiple accounts in parallel using threads. Each account is authenticated and stored for cluster actions.
Properties:
- baseurl: str
- tokens: list[str] or list[ClientAuth]
- ClientRequests: ClientRequests
- Forum: ForumManager
- GroupManager: GroupManager
Methods:
__init__(credentials)
Authenticate multiple accounts concurrently, initialize managers.
References: ClientAuth, ClientRequests, ForumManager, GroupManager
post(url, payload)
Send a POST request to the WRTS API.
Class ClientRequests
File: Base/ClientRequests.py
Description: Handles HTTP requests (GET/POST) to the WRTS API. Supports both single and cluster modes.
Properties:
- tokens: list[str] or list[ClientAuth]
- token: str
- isCluster: bool
- baseurl: str
- headers: dict
Methods:
__init__(token=None, isCluster=False, tokens=None)
Initialize request handler for single or cluster mode.
References: InvalidClientError
get(url)
Send a GET request to the WRTS API.
post(url, payload)
Send a POST request to the WRTS API. In cluster mode, posts concurrently with all tokens.
Class ForumManager
File: Classes/ForumManager.py
Description: Fetches forum posts and individual posts using the API. Returns ForumPost objects.
Properties:
- ClientRequests: ClientRequests
Methods:
__init__(clientrequests)
Initialize with a ClientRequests instance.
References: ClientRequests
fetchForumPosts(limit=20)
Fetch a list of forum posts (as ForumPost objects).
References: ForumPost
fetchPost(id)
Fetch a single forum post by ID.
References: ForumPost
Class ForumPost
File: Classes/ForumPost.py
Description: Represents a forum post, including its answers, author, and metadata. Can post answers to the forum.
Properties:
- clientrequests: ClientRequests
- id: str
- title: str
- content: str
- topic: str or None
- closed: bool or None
- author: User
- answers: list[ForumAnswer]
Methods:
__init__(data, clientrequests)
Initialize ForumPost from API data.
References: User, ForumAnswer
answer(content)
Post an answer to this forum post.
Class ForumAnswer
File: Classes/ForumAnswer.py
Description: Represents an answer to a forum post. Supports liking and unliking answers.
Properties:
- id: str
- content: str
- author: User
- votes: int
- correct: bool
- questionId: str
- clientrequests: ClientRequests
- liked: bool
Methods:
__init__(clientrequests, data)
Initialize ForumAnswer from API data.
References: User
like()
Like this answer. Raises InvalidActionError if already liked.
References: InvalidActionError
unlike()
Unlike this answer. Raises InvalidActionError if not liked.
References: InvalidActionError
Class User
File: Classes/User.py
Description: Represents a user, including profile information and achievements.
Properties:
- clientrequests: ClientRequests
- id: str
- username: str
- first_name: str
- grade_display: str
- profile_image_url: str
- highlighted_achievement: str
- package_name: str
- tutor: bool
- employee: bool
- profile_image: UserProfileImage
Methods:
__init__(clientrequests, data)
Initialize User from API data.
References: UserProfileImage
Class UserProfileImage
File: Classes/UserProfileImage.py
Description: Stores user profile image data.
Properties:
- image_url: str
- profile_color: str
- profile_letter: str
Methods:
__init__(data)
Initialize UserProfileImage from data.
Class GroupManager
File: Classes/GroupManager.py
Description: Manages group-related actions, such as fetching group invites.
Properties:
- clientrequests: ClientRequests
Methods:
__init__(clientrequests)
Initialize with a ClientRequests instance.
References: ClientRequests
fetchGroupInvite(code, groupId)
Return a GroupInvite object for the given code and groupId.
References: GroupInvite
Class GroupInvite
File: Classes/GroupInvite.py
Description: Represents a group invite and allows joining a group using a code.
Properties:
- clientrequests: ClientRequests
- code: str
- groupId: str
Methods:
__init__(code, groupId, clientrequests)
Initialize GroupInvite with code and groupId.
join()
Join the group using the invite code.
Function genHeaders
File: Base/ClientRequests.py
Description: Generate HTTP headers for API requests using the given token.
Parameters: token
Function solve
File: captha.py
Description: Solve Google reCAPTCHA v2 using CapMonster.
Parameters: key, url, client_key
Error TokenInvalidError
File: Errors.py
Description: Raised when authentication fails. Used in Client and ClientAuth.
Error InvalidActionError
File: Errors.py
Description: Raised when an invalid action is attempted (e.g., liking an already liked answer). Used in ForumAnswer.
Error InvalidClientError
File: Errors.py
Description: Raised when client or cluster is initialized with invalid parameters. Used in ClientRequests.