Skip to main content

gdz-ru-py

License Python Version PyPI - Version

Python library for using gdz.ru API


Table of Contents

Installation

Stable version

$ pip install gdzru --upgrade

Latest version

$ pip install https://github.com/OctoDiary/OctoDiary-py/archive/main.zip --upgrade

Using

from gdzru import AsyncAPI, SyncAPI

async def amain():
    """
    Asynchronous using GDZ.ru API
    """
    api = AsyncAPI()

    # Get info for classes, subjects, books, etc.
    info = await api.get_books_list()

    # Get info for one book
    book_info = await api.get_book(info.books[0].url)

    # Print book authors, title, etc.
    print("Title:", book_info.book.title)
    print("Authors:", ", ".join(book_info.book.authors))
    print("Year:", book_info.book.year)
    print("Publisher:", book_info.book.publisher)

    # Get get first task of first book structure
    task_info = await api.get_task(book.structure[0].tasks[0].url)
    print("Task title:", task_info.task.title)


    # Get images of task
    images: list[bytes] = [
        await api.get_image(image.url)
        for image in task_info.task.editions[0].images
    ]

def main():
    """
    Synchronous using GDZ.ru API
    """
    api = SyncAPI()

    # Get info for classes, subjects, books, etc.
    info = api.get_books_list()

    # Get info for one book
    book_info = api.get_book(info.books[0].url)

    # Print book authors, title, etc.
    print("Title:", book_info.book.title)
    print("Authors:", ", ".join(book_info.book.authors))
    print("Year:", book_info.book.year)
    print("Publisher:", book_info.book.publisher)

    # Get get first task of first book structure
    task_info = api.get_task(book.structure[0].tasks[0].url)

    # Print task title
    print("Task title:", task_info.task.title)

    # Get images of task
    images: list[bytes] = [
        api.get_image(image.url)
        for image in task_info.task.editions[0].images
    ]

License

gdzru is distributed under the terms of the MIT license.

Metadata

Release files for gdzru 1.0.0

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

Source distribution (sdist)

Source distribution for gdzru 1.0.0
File Size Uploaded Provenance Actions
gdzru-1.0.0.tar.gz 6.0 kB Without provenance Details for gdzru-1.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 14.8 kB

Release files / gdzru-1.0.0.tar.gz

Download URL gdzru-1.0.0.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6fcfed6ab537ddbd6128638e036155c7135f5f582f2654212ffe06328f2d667d
BLAKE2b-256 checksum
How to use checksums
f9124cc1a26cd4e11a5f854532cde57dfe5098c3ed5f228e0e0049ee5a47cbef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / gdzru-1.0.0-py3-none-any.whl

Download URL gdzru-1.0.0-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eaf0650cb19c8231d5acf068e72ae395f9edb1006a1c5ebd4a468897d773384d
BLAKE2b-256 checksum
How to use checksums
6e8f25723d067e91de8442a83970dd521a074e149a6d6bc09f90252d20066bf3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Security for gdzru 1.0.0

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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