Skip to main content

aiomes

AIOMES - ассинхронная Python-библиотека, написанная на aiohttp и async_playwright, с легким доступом к сервису МЭШ

Примечание:

Библиотека может работать только с профилем ученика.

Установка:

pip install aiomes
playwright install firefox

Оглавление методов библиотеки:

Методы:

Авторизация по логину и паролю

from playwright.async_api import async_playwright
import asyncio
import aiomes

LOGIN = ...
PASSWORD = ...

async def main():
    async with async_playwright() as p:
        auth = await aiomes.AUTH(p)
        token = await auth.obtain_token(LOGIN, PASSWORD)

        if token == '2FA_NEEDED':
            sms_code = str(input())  # Реализация вашей логики получения 2FA-кода
            token = await auth.proceed_2fa(sms_code)

    user = await aiomes.Client(token)

asyncio.run(main())

Авторизация по токену

import asyncio
import aiomes

TOKEN = ...

async def main():
  user = await aiomes.Client(TOKEN)

asyncio.run(main())

Получение расписания

schedule = await user.get_schedule()

for subject in schedule:
    print(f"{subject.name}, {subject.start_time} - {subject.end_time}, к. {subject.room_number}; {subject.marks}")

Получение короткого расписания

today = date.today()
short_schedule = await user.get_schedule_short([today, today+timedelta(1), ...])
    
for subject in short_schedule:
    print(f"{subject.name}, {subject.start_time} - {subject.end_time}")

Получение расписания каникул

periods_schedule = await user.get_periods_schedule()

for subject in periods_schedule:
    print(f"{period.name}: {period.starts} — {period.ends}")

Получение домашнего задания

homework = await user.get_homeworks(from_date=date.today(), to_date=date.today())

for hw in homework:
    print(hw.hw_date.strftime('%d/%m'))
    print(f"{hw.subject_name}: {hw.description}; {hw.attached_files}, {hw.attached_tests}")
    print("-"*15)

Получение оценок

marks = await user.get_marks(from_date=date.today()-timedelta(7), to_date=date.today())

for mark in sorted(marks, key=lambda x: x.mark_date):
    print(f"{mark.subject_name}: {mark.value} [{mark.weight}] - {mark.reason}")

Получение оценок за период

period_marks = await user.get_period_marks(year_id=user.class_level, period_id=0)  # [Текущий класс, первый период]

for per_mark in period_marks:
    print(f"{per_mark.subject_name} - {per_mark.average_mark}, {per_mark.final_mark}; {per_mark.marks}")

Получение итог. оценок за прошлые года

past_marks = await user.get_past_final_marks(class_number=9)  # [Номер класса]

for past_mark in past_marks:
    print(f"{past_mark.subject_name} - {past_mark.final_mark}")

Получение информации о школе

school = await user.get_school_info()

print(school.name, school.address)
print(school.site, school.email)
print(school.principal)

Получение меню школьной столовой

today = date.today()
menu = await user.get_menu(today)

for item in menu:
    print(f'{item.title} — {item.price}:')
    for meal in item.composition:
        print(f'- {meal.name}, {meal.ingredients}, {meal.calories}')
    print('-'*35)

Получение меню школьного буфета

today = date.today()
buffet_menu = await user.get_menu_buffet(today)

for item in buffet_menu:
    print(item.name, item.full_name, item.price, item.is_available)

Получение посещаемости

today = date.today()
attendance = await user.get_visits(from_date=today - timedelta(7), to_date=today)

for day in attendance:
    print(f"{day.visit_date}: {day.in_time}-{day.out_time}, {day.duration}")

Получение всех уведомлений

notifications = await user.get_notifications()

for n in notifications:
    n_date = datetime.strftime(n.event_date, '%d/%m')
    print(f'{n_date}, {n.event_name} [{n.mark_value}], [{n.hw_description}]')

Получение рейтинга в классе

today = date.today()
ranking = await user.get_class_rank(date_from=today - timedelta(7), date_to=today)

for day in ranking:
    print(f"{day.rank_date}, {day.place}")

Получение документов ученика

docs = await user.get_docs()

for doc in docs:
    print(f"{doc.type_id} / {doc.series}, {doc.number} / {doc.issuer}, {doc.issue_date}")

Получение списка предметов

subjects = await user.get_subjects()

print(", ".join(subjects))

[ Asyncronous Input Output Moscow Electronic School ]

Metadata

Release files for aiomes 1.5.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aiomes 1.5.2
File Size Uploaded Provenance Actions
aiomes-1.5.2.tar.gz 11.9 kB Without provenance Details for aiomes-1.5.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aiomes 1.5.2
File Interpreter ABI Platform Actions
aiomes-1.5.2-py3-none-any.whl Python 3 none any Details for aiomes-1.5.2-py3-none-any.whl

Total release size: 22.8 kB

Release files / aiomes-1.5.2.tar.gz

Download URL aiomes-1.5.2.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
99f51d223bd676a147c4dad85593c185e99cb56b25020772a6ecaef832e01d87
BLAKE2b-256 checksum
How to use checksums
7366582f7f35e4aa48d18437d98a5a8d99c572d04ff877717f7fd16b2003bc03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.0

Release files / aiomes-1.5.2-py3-none-any.whl

Download URL aiomes-1.5.2-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c60d90b8b4454fc59366217a9f49f0a76ab9badb7234fb910b7eee5cb271e87c
BLAKE2b-256 checksum
How to use checksums
a48b1132a5cffebaffc086fbb5ef6ebb5457457113659796c4a6a006046bc2c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.12.0

Security for aiomes 1.5.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page