Metadata-Version: 2.1
Name: sudogdz
Version: 1.0.2
Summary: Parser of everything from the Russian reshebnik GDZ.RU
Author: aye20054925
Requires-Python: >=3.6
Description-Content-Type: text/markdown
Classifier: Development Status :: 5 - Production/Stable
Classifier: Topic :: Internet
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Classifier: Topic :: Education
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: License :: OSI Approved :: MIT License
Requires-Dist: requests
Requires-Dist: beautifulsoup4

# SudoGDZ
Parser of everything from the Russian reshebnik GDZ.RU

## Install
To start, execute this command in command line
```bash
pip install sudogdz
```

## Using and examples
### Get books and copybooks from GDZ.ru
To start using you have to import `sudogdz` into your project
```python
import sudogdz
```
Lets get a list of algebra textbooks for 7 Class and print textbook name and authors?
##### script.py
```python
import sudogdz as gdz

schoolitems = (
    gdz.getSchoolItems()
)  # ["matematika", "english", "russkii_yazik", "algebra", ...]

for i in gdz.getBooks("books", schoolclass=7, schoolitem=schoolitems[3]):
    print(f'{i["name"]}\n{i["class"]}')
```

### Get information about book / copybook
To get information about the textbook, we need to call the `getBooks` function and select the desired item. 
<br/>
We can get information about the textbook such as name, url, authors, publish house, class and cover.
##### script.py
```python
import sudogdz as gdz

schoolitems = (
    gdz.getSchoolItems()
)  # ["matematika", "english", "russkii_yazik", "algebra", ...]

booklist = gdz.getBooks("books", schoolclass=7, schoolitem=schoolitems[3])

book = booklist[3]  # can be any number as you want.

print(
    f"""
Имя: {book["name"]}
Ссылка: {book["url"]["with_domain"]}
Авторы: {",".join(book["authors"])}
Издательство: {book["pubhouse"]}
Обложка: {book["cover"]}
"""
)
```
### Get task list for book / copybook
To get a list of tasks for a specific book, you need to take the URL of the book and call the `getTasksForBook` function
##### script.py
```python
import sudogdz as gdz

books = gdz.getBooks("popularBooks")

book = books[6]

print(
    gdz.getTasksForBook(book["url"]["without_domain"])
)  # you could replace "without_domain" on "with_domain".
```

### Get answers for book / copybook
To get a list of answers, you also need to take the book's URL and call the `getAnswerForBook` function. You can parse the response image.
##### script.py
```python
import sudogdz as gdz

for answer in gdz.getAnswerForBook(
    "https://gdz.ru/class-6/matematika/a-g-merzlyak/3-18/"
):
    print(answer["png"])  # answer image.
```

## Build from source
In order to build a library from source, you need to install some dependencies
```bash
pip install -r requirements.txt
```
Since the library uses flit to easily build the library, you need to enter the following command
```bash
flit build
```

