Library implementing API schedules of SPbPu
Project description
Library implementing API
How to use:
You are required to create an ApiSpbStuRuz using async with statement. For example like this:
import asyncio
import ApiSpbStuRuz
async def main():
async with ApiSpbStuRuz.ApiSpbStuRuz() as api:
teacher = await api.get_teacher_by_id(999335)
print(teacher)
if __name__ == "__main__":
asyncio.run(main())
When you create a class, you have a number of parameters:
- create_logger - if you want to use a logger, pass True, otherwise don't change.
- path_log - the path to the folder where the logger will write logs.
Before using, do not forget to enable the logger. - try_create_dict - If you want the logger not to try to create a folder with logs, then turn off this parameter.
- proxy - If you want to use a proxy for requests, then pass them to this parameter.
Proxies are not used as standard. The proxy should be transmitted in the format required by the aiohttp library - timeout - If you want to change the request timeout from 5 seconds, then use this parameter
Functions:
get_faculties- returns a list of facultiesget_faculty_by_id- gets the id of the faculty, returns an object with the facultyget_groups_on_faculties_by_id- gets the faculty number, returns a list of groups in this facultyget_teachers- returns a list of teachers (can take a long time to run because there is a lot of data)get_teacher_by_id- returns the teacher by his id (not oid)get_teacher_scheduler_by_id- returns the teacher's schedule by its id (not oid)get_teacher_scheduler_by_id_and_date- returns the teacher's schedule by its id (not oid) on a specific date (actually returns the schedule for the week on which this date is)get_buildings- returns a list of buildingsget_building_by_id- returns a building by its idget_rooms_by_building_id- returns rooms in a building by its idget_rooms_scheduler_by_id_and_building_id- returns the schedule of the room by its id in the building by its idget_rooms_scheduler_by_id_and_building_id_and_date- returns the schedule of the room by its id in the building by its id on a certain date (actually returns the schedule for the week on which this date is)get_groups_scheduler_by_id- returns the group schedule by its idget_groups_scheduler_by_id_and_date- returns the group schedule by its id by date (actually returns the schedule for the week on which this date is)get_groups_by_name- returns a group object by its name (СЃan return multiple objects)get_teachers_by_name- returns a teacher object by her name (СЃan return multiple objects)get_rooms_by_name- returns a room object by its name (СЃan return multiple objects)
Paths:
- https://ruz.spbstu.ru/api/v1/ruz
- /faculties - getting a list of faculties (institutes)
- /id - getting the name by the id of the department (institute)
- /groups - getting a list of groups by department (institute) id
- /id - getting the name by the id of the department (institute)
- /teachers - list of all teachers
- /id - search for a teacher by id
- /scheduler - teacher's schedule by his id for the current week
- ?date=yyyy-mm-dd - teacher's schedule by his id for the week with the entered date
- /scheduler - teacher's schedule by his id for the current week
- /id - search for a teacher by id
- /buildings - list of "structures"/buildings (Note that it has a bunch of garbage values)
- /id - search for "structures" by id
- /rooms - list of rooms in a building by its id
- /id/scheduler - schedule by room's id
- ?date=yyyy-mm-dd - similarly by date
- /id/scheduler - schedule by room's id
- /rooms - list of rooms in a building by its id
- /id - search for "structures" by id
- /scheduler/id - getting a schedule by group id for the current week
- ?date=yyyy-mm-dd - getting a week by a specific date
- /search
- /groups?q=name - search for a group by its name (example name="3530901/10001" -> 35376)
- /teachers?q=name - search for a teacher by first name/last name/patronymic/full_name (replace spaces with %20 when requested)
- /rooms?q=name - search by audience name
- /faculties - getting a list of faculties (institutes)
Files:
- apiSpbStuRuz.py - this file implements the basic API logic
- dataClasses.py - this file contains all the data classes into which the received data is converted
- logConfig.py - this file contains the settings for the logger
- apiSpbStuRuzExeptions.py - this file contains all the exceptions that are thrown during the operation of the application
- apiPaths.py - this file stores all the paths that the library uses for requests to the server
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
ApiSpbStuRuz-1.1.2.tar.gz
(10.9 kB
view details)
File details
Details for the file ApiSpbStuRuz-1.1.2.tar.gz.
File metadata
- Download URL: ApiSpbStuRuz-1.1.2.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
baca0d9fac83a5f993ac262395a1c8ff03d90e6b8cc6205ba3e69e0eafd3c8cb
|
|
| MD5 |
cbb02e4c5213b6293c8499a366434d44
|
|
| BLAKE2b-256 |
5bf3137a19a946db748b5679c1362887191d43046dfc26891a5f0372aaf42b26
|