Async-sdamgia-api
Неофициальный асинхронный Python-клиент для работы с платформой sdamgia.ru: получение задач, поиск, работа с категориями и тестами, генерация PDF и OCR-поиск по изображению.
Что умеет
- получать задачу по
id(get_problem_by_id) - искать задачи по тексту (
search) - получать задачи теста по
testid(get_test_by_id) - получать задачи категории (
get_category_by_id) - загружать каталог тем и категорий (
get_catalog) - генерировать тест (
generate_test) - получать ссылку на PDF теста (
generate_pdf) - искать задачи по изображению через OCR (
search_by_img)
Поддерживаемые предметы (коды):
math, mathb, phys, inf, rus, bio, en, chem, geo, soc, de, fr, lit, sp, hist.
Установка
Требования:
- Python
3.12+
pip install sdamgia-api
Для разработки:
python -m pip install --upgrade pip
python -m pip install -e .[dev]
Быстрый старт
import asyncio
from sdamgia import SdamGIA
async def main() -> None:
async with SdamGIA() as api:
problem = await api.get_problem_by_id("math", "1001")
print(problem["id"], problem["answer"])
asyncio.run(main())
Примеры API
# Поиск задач
ids = await api.search("math", "Найдите количество")
# Каталог предмета
topics = await api.get_catalog("math")
# Генерация теста и PDF
new_test_id = await api.generate_test("math", {"full": 1})
pdf_url = await api.generate_pdf("math", new_test_id, pdf="h")
Рендер задачи в изображение (get_problem_by_id) поддерживает img:
pyppeteergrabzithtml2img
OCR-поиск по изображению
Метод search_by_img использует pytesseract.
- Установите Python-пакет (если не установлен):
pip install pytesseract
- Установите
Tesseract-OCRв ОС и при необходимости укажите путь:
api.tesseract_src = "/usr/bin/tesseract"
# Windows пример: C:/Program Files/Tesseract-OCR/tesseract.exe
- Запустите поиск:
ids = await api.search_by_img("rus", "Image.jpg")
Тесты
В проекте используется live-контур (реальные запросы к *.sdamgia.ru):
pytest -m live -q
Важно:
- тесты зависят от сети и доступности внешнего сайта
- структура внешнего HTML может меняться без предупреждения
- OCR ветка в тестах замокана (без обязательной установки Tesseract)
CI
GitHub Actions запускает live-тесты на push и pull_request для Python 3.12 и 3.13.
При падении сохраняются логи (junit + live.log) как artifacts.
Для AI-агентов
В репозитории есть файл AGENTS.md с обязательными правилами для агентной разработки:
- кодстайл и требования к Python-коду
- правила по docstring (Google-style)
- требования к тестам
- список доступных skills и когда их применять
Если вы используете Codex/агента, начинайте с чтения AGENTS.md.
Лицензия
MIT
Metadata
Release files for Async-SdamGia-Api 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| async_sdamgia_api-0.0.1.tar.gz | 9.6 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| async_sdamgia_api-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.3 kB
Release files / async_sdamgia_api-0.0.1.tar.gz
| Download URL | async_sdamgia_api-0.0.1.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b031f5a4ff299ae75ae3a09d871952f1c3094b565d8f1e27ee3a0cb16ca4d59b
|
|
BLAKE2b-256 checksum How to use checksums |
87a6788422df81aa4c321c4eb2a9e532adbee9f582dc847ec6e8ae6af01ba983
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 10, 2026.
Transparency logRelease files / async_sdamgia_api-0.0.1-py3-none-any.whl
| Download URL | async_sdamgia_api-0.0.1-py3-none-any.whl |
|---|---|
| Size | 10.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2dce798e93157339d617d2457afe25f45c25de2ca9efc5ddd05b9bbaa217d891
|
|
BLAKE2b-256 checksum How to use checksums |
d279c2f7081088d58ac4cea1c87ea722653d732099f802d46a7cca9749c631e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 10, 2026.
Transparency logSecurity for Async-SdamGia-Api 0.0.1
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for async_sdamgia_api-0.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Feb 10, 2026.
Transparency logA 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.