sdamgia


Namesdamgia JSON
Version 0.2.0 PyPI version JSON
download
home_pageNone
SummaryUnofficial API for SdamGIA educational portal for exam preparation written in Python.
upload_time2024-06-14 00:41:32
maintainerNone
docs_urlNone
authorДинаzavr
requires_python<4.0,>=3.10
licenseLGPL-3.0-or-later
keywords sdamgia api asyncio
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 📚 SdamGIA API

[![License](https://img.shields.io/pypi/l/sdamgia?color=green&style=flat-square)](https://github.com/dinaprk/sdamgia-python/blob/master/LICENSE)
[![Version](https://img.shields.io/pypi/v/sdamgia?style=flat-square)](https://pypi.org/project/sdamgia)
[![Python Version](https://img.shields.io/pypi/pyversions/sdamgia?style=flat-square)](https://pypi.org/project/sdamgia)
[![Status](https://img.shields.io/pypi/status/sdamgia?style=flat-square)](https://pypi.org/project/sdamgia)
[![Documentation](https://img.shields.io/github/actions/workflow/status/dinaprk/sdamgia-python/docs.yml?label=docs&style=flat-square)](https://dinaprk.github.io/sdamgia-python)

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](https://github.com/dinaprk/sdamgia-python/issues).

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:

```shell
pip install -U sdamgia
```

For full problem text recognition support `pix2tex` extra is required,
which can be installed like so:

```shell
pip install -U "sdamgia[pix2tex]"
```

### poetry

You can add the library as a dependency like so:

```shell
poetry add sdamgia
```

With full text recognition support:

```shell
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](https://dinaprk.github.io/sdamgia-python).

## 🚀 Basic usage

Because SdamgiaAPI client is asynchronous, it needs to be initialized in asynchronous context:

```python
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:

```python
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](https://github.com/dinaprk/sdamgia-python/blob/master/LICENSE) for details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "sdamgia",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "sdamgia, api, asyncio",
    "author": "\u0414\u0438\u043d\u0430zavr",
    "author_email": "dinaprk@cumallover.me",
    "download_url": "https://files.pythonhosted.org/packages/4f/af/31639d385384d2860928fde45761dd06286bb792bd88dbe7a77ac5d69962/sdamgia-0.2.0.tar.gz",
    "platform": null,
    "description": "# \ud83d\udcda SdamGIA API\n\n[![License](https://img.shields.io/pypi/l/sdamgia?color=green&style=flat-square)](https://github.com/dinaprk/sdamgia-python/blob/master/LICENSE)\n[![Version](https://img.shields.io/pypi/v/sdamgia?style=flat-square)](https://pypi.org/project/sdamgia)\n[![Python Version](https://img.shields.io/pypi/pyversions/sdamgia?style=flat-square)](https://pypi.org/project/sdamgia)\n[![Status](https://img.shields.io/pypi/status/sdamgia?style=flat-square)](https://pypi.org/project/sdamgia)\n[![Documentation](https://img.shields.io/github/actions/workflow/status/dinaprk/sdamgia-python/docs.yml?label=docs&style=flat-square)](https://dinaprk.github.io/sdamgia-python)\n\nUnofficial API for SdamGIA educational portal for exam preparation written in Python.\n\n### \u26a0\ufe0f Important Note\n\nThis library retrieves data by parsing HTML because sdamgia uses server-side rendering, which\nis not very reliable, but the only method available at the moment. We strive to keep the API\nup to date to work as expected. However, if you encounter any issues,\nplease [report them](https://github.com/dinaprk/sdamgia-python/issues).\n\nUse of this library is at your own risk. Sdamgia explicitly restricts parsing, and we do not\ntake responsibility for any legal issues that arise from using this library.\n\n## \ud83d\udce6 Installing\n\n**Python 3.10 or above is required.**\n\n### pip\n\nInstalling the library with `pip` is quite simple:\n\n```shell\npip install -U sdamgia\n```\n\nFor full problem text recognition support `pix2tex` extra is required,\nwhich can be installed like so:\n\n```shell\npip install -U \"sdamgia[pix2tex]\"\n```\n\n### poetry\n\nYou can add the library as a dependency like so:\n\n```shell\npoetry add sdamgia\n```\n\nWith full text recognition support:\n\n```shell\npoetry add sdamgia --extras pix2tex\n```\n\n## \ud83d\uddc2\ufe0f Problems database structure\n\nTo make it easier to understand how the SdamGIA problems database is structured, I suggest using\nthe following scheme:\n\n```\nSdamGIA\n\u2514\u2500\u2500 GIA type, Subject\n    \u251c\u2500\u2500 Problem catalog\n    \u2502   \u2514\u2500\u2500 Topic\n    \u2502       \u2514\u2500\u2500 Category\n    \u2502           \u2514\u2500\u2500 Problem\n    \u2514\u2500\u2500 Test\n        \u2514\u2500\u2500 Problem\n```\n\nEach problem, test, theme or category has its own *unique* integer ID.\n\n## \ud83d\udcc3 Documentation\n\nYou can find the documentation [here](https://dinaprk.github.io/sdamgia-python).\n\n## \ud83d\ude80 Basic usage\n\nBecause SdamgiaAPI client is asynchronous, it needs to be initialized in asynchronous context:\n\n```python\nimport asyncio\nimport dataclasses\nimport json\n\nfrom sdamgia import SdamgiaAPI\nfrom sdamgia.types import Problem\nfrom sdamgia.enums import GiaType, Subject\n\n\ndef problem_to_json(problem: Problem) -> str:\n    return json.dumps(dataclasses.asdict(problem), indent=4, ensure_ascii=False)\n\n\nasync def main() -> None:\n    async with SdamgiaAPI(gia_type=GiaType.EGE, subject=Subject.MATH) as sdamgia:\n        problem_id = 26596\n        problem = await sdamgia.get_problem(problem_id, subject=Subject.MATH)\n        print(problem_to_json(problem))\n        print(problem.url)  # https://math-ege.sdamgia.ru/problem?id=26596\n\n\nif __name__ == \"__main__\":\n    asyncio.run(main())\n```\n\nOr without context manager:\n\n```python\nfrom sdamgia import SdamgiaAPI\nfrom sdamgia.enums import GiaType, Subject\n\n\nasync def main() -> None:\n    sdamgia = SdamgiaAPI(gia_type=GiaType.EGE, subject=Subject.MATH)\n    # ... do something with client\n    await sdamgia.close()  # this line is mandatory\n```\n\n## \ud83d\udcdc License\n\nThis project is licensed under the LGPLv3+ license - see the\n[license file](https://github.com/dinaprk/sdamgia-python/blob/master/LICENSE) for details.\n",
    "bugtrack_url": null,
    "license": "LGPL-3.0-or-later",
    "summary": "Unofficial API for SdamGIA educational portal for exam preparation written in Python.",
    "version": "0.2.0",
    "project_urls": {
        "Documentation": "https://dinaprk.github.io/sdamgia-python",
        "Issue Tracker": "https://github.com/dinaprk/sdamgia-python/issues",
        "Repository": "https://github.com/dinaprk/sdamgia-python"
    },
    "split_keywords": [
        "sdamgia",
        " api",
        " asyncio"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "23b4b7fa68f38922f00435eb1ae062844ac4ee01c5192d8da61ebb1187eb7ab5",
                "md5": "0bcac78f6de759f4a88537e3e54c659e",
                "sha256": "58b7a9672b6da59659fdc0f7aadf28be084653c1d93646891547a2ca4c3b0806"
            },
            "downloads": -1,
            "filename": "sdamgia-0.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0bcac78f6de759f4a88537e3e54c659e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 12316,
            "upload_time": "2024-06-14T00:41:30",
            "upload_time_iso_8601": "2024-06-14T00:41:30.697138Z",
            "url": "https://files.pythonhosted.org/packages/23/b4/b7fa68f38922f00435eb1ae062844ac4ee01c5192d8da61ebb1187eb7ab5/sdamgia-0.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4faf31639d385384d2860928fde45761dd06286bb792bd88dbe7a77ac5d69962",
                "md5": "f570c1220896367030dc14fbdb264611",
                "sha256": "26dd03b54c057ff15c94fda4f2ce06c71241f58d1275696f1e32618378a12af9"
            },
            "downloads": -1,
            "filename": "sdamgia-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "f570c1220896367030dc14fbdb264611",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 12838,
            "upload_time": "2024-06-14T00:41:32",
            "upload_time_iso_8601": "2024-06-14T00:41:32.532184Z",
            "url": "https://files.pythonhosted.org/packages/4f/af/31639d385384d2860928fde45761dd06286bb792bd88dbe7a77ac5d69962/sdamgia-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-14 00:41:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dinaprk",
    "github_project": "sdamgia-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "sdamgia"
}
        
Elapsed time: 0.40538s