📚 SdamGIA API
Unofficial API for SdamGIA educational portal for exam preparation written in Python.
⚠️ Important Note
This library retrieves data by parsing HTML because sdamgia uses server-side rendering, which is not very reliable, but the only method available at the moment. We strive to keep the API up to date to work as expected. However, if you encounter any issues, please report them.
Use of this library is at your own risk. Sdamgia explicitly restricts parsing, and we do not take responsibility for any legal issues that arise from using this library.
📦 Installing
Python 3.10 or above is required.
pip
Installing the library with pip is quite simple:
pip install -U sdamgia
For full problem text recognition support pix2tex extra is required,
which can be installed like so:
pip install -U "sdamgia[pix2tex]"
poetry
You can add the library as a dependency like so:
poetry add sdamgia
With full text recognition support:
poetry add sdamgia --extras pix2tex
🗂️ Problems database structure
To make it easier to understand how the SdamGIA problems database is structured, I suggest using the following scheme:
SdamGIA
└── GIA type, Subject
├── Problem catalog
│ └── Topic
│ └── Category
│ └── Problem
└── Test
└── Problem
Each problem, test, theme or category has its own unique integer ID.
📃 Documentation
You can find the documentation here.
🚀 Basic usage
Because SdamgiaAPI client is asynchronous, it needs to be initialized in asynchronous context:
import asyncio
import dataclasses
import json
from sdamgia import SdamgiaAPI
from sdamgia.types import Problem
from sdamgia.enums import GiaType, Subject
def problem_to_json(problem: Problem) -> str:
return json.dumps(dataclasses.asdict(problem), indent=4, ensure_ascii=False)
async def main() -> None:
async with SdamgiaAPI(gia_type=GiaType.EGE, subject=Subject.MATH) as sdamgia:
problem_id = 26596
problem = await sdamgia.get_problem(problem_id, subject=Subject.MATH)
print(problem_to_json(problem))
print(problem.url) # https://math-ege.sdamgia.ru/problem?id=26596
if __name__ == "__main__":
asyncio.run(main())
Or without context manager:
from sdamgia import SdamgiaAPI
from sdamgia.enums import GiaType, Subject
async def main() -> None:
sdamgia = SdamgiaAPI(gia_type=GiaType.EGE, subject=Subject.MATH)
# ... do something with client
await sdamgia.close() # this line is mandatory
📜 License
This project is licensed under the LGPLv3+ license - see the license file for details.
Release files for sdamgia 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sdamgia-0.2.0.tar.gz | 12.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sdamgia-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.2 kB
Release files / sdamgia-0.2.0.tar.gz
| Download URL | sdamgia-0.2.0.tar.gz |
|---|---|
| Size | 12.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
26dd03b54c057ff15c94fda4f2ce06c71241f58d1275696f1e32618378a12af9
|
|
BLAKE2b-256 checksum How to use checksums |
4faf31639d385384d2860928fde45761dd06286bb792bd88dbe7a77ac5d69962
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.3 Linux/6.9.3-arch1-1
|
Release files / sdamgia-0.2.0-py3-none-any.whl
| Download URL | sdamgia-0.2.0-py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
58b7a9672b6da59659fdc0f7aadf28be084653c1d93646891547a2ca4c3b0806
|
|
BLAKE2b-256 checksum How to use checksums |
23b4b7fa68f38922f00435eb1ae062844ac4ee01c5192d8da61ebb1187eb7ab5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.3 Linux/6.9.3-arch1-1
|