API¶
APIs are wrappers around client for interaction with API Servers
Abstract API¶
Base class for API
- class chsu_schedule_api.api.abc.ABCApi(client: ABCHttpClient)[source]¶
Abstract API class.
If you want to create your own API, you should inherit this class.
CHSU API¶
API implementation for interaction with CHSU Schedule API
- class chsu_schedule_api.api.chsu.CHSUApi(username: str, password: str, client: ABCHttpClient | None = None)[source]¶
CHSU API wrapper class.
- auth_signin() bool[source]¶
Authorize method.
- Raises:
CHSUApiUnauthorizedError – Invalid auth data
CHSUApiResponseError – invalid response
- Returns:
On success,
Trueis returned.
- auth_valid(token: str) bool[source]¶
Validate auth token.
- Parameters:
token – auth token
- Returns:
If token is valid,
Trueis returned.
- get_auditoriums() list[Auditorium][source]¶
Get auditoriums method.
Get list of all auditoriums.
- Returns:
- get_departments() Department[source]¶
Get departments method.
Get departments node tree
- Returns:
- get_disciplines() list[Discipline][source]¶
Get disciplines method.
Get list of all disciplines.
- Returns:
- get_numweek(date: datetime) int[source]¶
Get the number of the academic week for a given date.
- Parameters:
date – week date
- Raises:
CHSUApiResponseError – invalid response
- Returns:
Number of the academic week
- get_student_groups() list[StudentGroup][source]¶
Get student groups method.
Get list of all student groups.
- Returns:
- get_time_table(time_table: TimeTableType | TitleTimeTableType) list[TimeTable][source]¶
Get time table method.
Get a time table for a specific lecturer, group, or get a full schedule
- Parameters:
time_table
- Raises:
CHSUApiResponseError – invalid response
- Returns:
- request(method: Methods, path: str, data: object = None, **kwargs) str | None¶
Make http request.
- request_json(method: Methods, path: str, data: object = None, **kwargs) dict | list | str | int¶
Make json http request.