chizhik-api


Namechizhik-api JSON
Version 0.1.7 PyPI version JSON
download
home_pagehttps://github.com/Open-Inflation/chizhik_api
SummaryA Python API client for Chizhik catalog
upload_time2025-04-25 21:43:56
maintainerNone
docs_urlNone
authorMiskler
requires_python>=3.10
licenseNone
keywords
VCS
bugtrack_url
requirements aiohttp camoufox snapshottest pytest pytest-asyncio setuptools
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Chizhik API *(not official / не официальный)*

Chizhik (Чижик) - https://chizhik.club/

[![GitHub Actions](https://github.com/Open-Inflation/chizhik_api/workflows/API%20Tests%20Daily/badge.svg)](https://github.com/Open-Inflation/chizhik_api/actions?query=workflow%3A"API+Tests+Daily?query=branch%3Amain")
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/chizhik_api)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/chizhik_api?label=PyPi%20downloads)](https://pypi.org/project/chizhik-api/)
[![Discord](https://img.shields.io/discord/792572437292253224?label=Discord&labelColor=%232c2f33&color=%237289da)](https://discord.gg/UnJnGHNbBp)
[![Telegram](https://img.shields.io/badge/Telegram-24A1DE)](https://t.me/miskler_dev)



## Installation / Установка:
1. Install package / Установка пакета:
```bash
pip install chizhik_api
```
2. ***Debian/Ubuntu Linux***: Install dependencies / Установка зависимостей:
```bash
sudo apt update && sudo apt install -y libgtk-3-0 libx11-xcb1
```
3. Install browser / Установка браузера:
```bash
camoufox fetch
```

### Usage / Использование:
```py
from chizhik_api import Chizhik
import asyncio


async def main():
    # RUS: Использование проксирования опционально. Вы можете создать несколько агентов с разными прокси для ускорения парса.
    # ENG: Proxy usage is optional. You can create multiple agents with different proxies for faster parsing.
    async with Chizhik(proxy="user:password@host:port", debug=False) as API:
        # RUS: Выводит активные предложения магазина
        # ENG: Outputs active offers of the store
        print(f"Active offers output: {await API.active_inout()!s:.100s}...\n")

        # RUS: Выводит список городов соответствующих поисковому запросу (только на русском языке)
        # ENG: Outputs a list of cities corresponding to the search query (only in Russian language)
        print(f"Cities list output: {await API.cities_list(search_name='ар', page=1)!s:.100s}...\n")
        # Счет страниц с единицы / index starts from 1

        # RUS: Выводит список всех категорий на сайте
        # ENG: Outputs a list of all categories on the site
        catalog = await API.categories_list()
        print(f"Categories list output: {catalog!s:.100s}...\n")

        # RUS: Выводит список всех товаров выбранной категории (ограничение 100 элементов, если превышает - запрашивайте через дополнительные страницы)
        # ENG: Outputs a list of all items in the selected category (limiting to 100 elements, if exceeds - request through additional pages)
        items = await API.products_list(category_id=catalog[0]['id'], page=1)
        print(f"Items list output: {items!s:.100s}...\n")
        # Счет страниц с единицы / index starts from 1

        # RUS: Сохраняем изображение с сервера (в принципе, сервер отдал бы их и без обертки моего объекта, но лучше максимально претворяться обычным пользователем)
        # ENG: Saving an image from the server (in fact, the server gave them and without wrapping my object, but better to be as a regular user)
        image = await API.download_image(items['items'][0]['images'][0]['image'])
        with open(image.name, 'wb') as f:
            f.write(image.getvalue())

        # RUS: Если требуется, можно настроить вывод логов в консоль после иницализации
        # ENG: If required, you can configure the output of logs in the console after initialization
        API.debug = True
        await API.products_list(category_id=catalog[0]['id'], page=2)

        # RUS: Так же как и debug, в рантайме можно переназначить прокси
        # ENG: As with debug, you can reassign the proxy in runtime
        API.proxy = "user:password@host:port"
        await API.products_list(category_id=catalog[0]['id'], page=3)


if __name__ == '__main__':
    asyncio.run(main())
```

### Report / Обратная связь

If you have any problems using it /suggestions, do not hesitate to write to the [project's GitHub](https://github.com/Open-Inflation/chizhik_api/issues)!

Если у вас возникнут проблемы в использовании / пожелания, не стесняйтесь писать на [GitHub проекта](https://github.com/Open-Inflation/chizhik_api/issues)!

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Open-Inflation/chizhik_api",
    "name": "chizhik-api",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "Miskler",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/7b/11/e8a031a229719a1d8963ad435869a6f877878470e74527584da67f513953/chizhik_api-0.1.7.tar.gz",
    "platform": null,
    "description": "# Chizhik API *(not official / \u043d\u0435 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439)*\n\nChizhik (\u0427\u0438\u0436\u0438\u043a) - https://chizhik.club/\n\n[![GitHub Actions](https://github.com/Open-Inflation/chizhik_api/workflows/API%20Tests%20Daily/badge.svg)](https://github.com/Open-Inflation/chizhik_api/actions?query=workflow%3A\"API+Tests+Daily?query=branch%3Amain\")\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/chizhik_api)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/chizhik_api?label=PyPi%20downloads)](https://pypi.org/project/chizhik-api/)\n[![Discord](https://img.shields.io/discord/792572437292253224?label=Discord&labelColor=%232c2f33&color=%237289da)](https://discord.gg/UnJnGHNbBp)\n[![Telegram](https://img.shields.io/badge/Telegram-24A1DE)](https://t.me/miskler_dev)\n\n\n\n## Installation / \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430:\n1. Install package / \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0430\u043a\u0435\u0442\u0430:\n```bash\npip install chizhik_api\n```\n2. ***Debian/Ubuntu Linux***: Install dependencies / \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439:\n```bash\nsudo apt update && sudo apt install -y libgtk-3-0 libx11-xcb1\n```\n3. Install browser / \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430:\n```bash\ncamoufox fetch\n```\n\n### Usage / \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435:\n```py\nfrom chizhik_api import Chizhik\nimport asyncio\n\n\nasync def main():\n    # RUS: \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0430\u0433\u0435\u043d\u0442\u043e\u0432 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u043a\u0441\u0438 \u0434\u043b\u044f \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0441\u0430.\n    # ENG: Proxy usage is optional. You can create multiple agents with different proxies for faster parsing.\n    async with Chizhik(proxy=\"user:password@host:port\", debug=False) as API:\n        # RUS: \u0412\u044b\u0432\u043e\u0434\u0438\u0442 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u0430\u0433\u0430\u0437\u0438\u043d\u0430\n        # ENG: Outputs active offers of the store\n        print(f\"Active offers output: {await API.active_inout()!s:.100s}...\\n\")\n\n        # RUS: \u0412\u044b\u0432\u043e\u0434\u0438\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0433\u043e\u0440\u043e\u0434\u043e\u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u043c\u0443 \u0437\u0430\u043f\u0440\u043e\u0441\u0443 (\u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0440\u0443\u0441\u0441\u043a\u043e\u043c \u044f\u0437\u044b\u043a\u0435)\n        # ENG: Outputs a list of cities corresponding to the search query (only in Russian language)\n        print(f\"Cities list output: {await API.cities_list(search_name='\u0430\u0440', page=1)!s:.100s}...\\n\")\n        # \u0421\u0447\u0435\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0441 \u0435\u0434\u0438\u043d\u0438\u0446\u044b / index starts from 1\n\n        # RUS: \u0412\u044b\u0432\u043e\u0434\u0438\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0439 \u043d\u0430 \u0441\u0430\u0439\u0442\u0435\n        # ENG: Outputs a list of all categories on the site\n        catalog = await API.categories_list()\n        print(f\"Categories list output: {catalog!s:.100s}...\\n\")\n\n        # RUS: \u0412\u044b\u0432\u043e\u0434\u0438\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0442\u043e\u0432\u0430\u0440\u043e\u0432 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 (\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u0435 100 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0435\u0441\u043b\u0438 \u043f\u0440\u0435\u0432\u044b\u0448\u0430\u0435\u0442 - \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0439\u0442\u0435 \u0447\u0435\u0440\u0435\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b)\n        # ENG: Outputs a list of all items in the selected category (limiting to 100 elements, if exceeds - request through additional pages)\n        items = await API.products_list(category_id=catalog[0]['id'], page=1)\n        print(f\"Items list output: {items!s:.100s}...\\n\")\n        # \u0421\u0447\u0435\u0442 \u0441\u0442\u0440\u0430\u043d\u0438\u0446 \u0441 \u0435\u0434\u0438\u043d\u0438\u0446\u044b / index starts from 1\n\n        # RUS: \u0421\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 (\u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u0441\u0435\u0440\u0432\u0435\u0440 \u043e\u0442\u0434\u0430\u043b \u0431\u044b \u0438\u0445 \u0438 \u0431\u0435\u0437 \u043e\u0431\u0435\u0440\u0442\u043a\u0438 \u043c\u043e\u0435\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u043d\u043e \u043b\u0443\u0447\u0448\u0435 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0442\u0432\u043e\u0440\u044f\u0442\u044c\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c)\n        # ENG: Saving an image from the server (in fact, the server gave them and without wrapping my object, but better to be as a regular user)\n        image = await API.download_image(items['items'][0]['images'][0]['image'])\n        with open(image.name, 'wb') as f:\n            f.write(image.getvalue())\n\n        # RUS: \u0415\u0441\u043b\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f, \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u043b\u043e\u0433\u043e\u0432 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u043f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438\n        # ENG: If required, you can configure the output of logs in the console after initialization\n        API.debug = True\n        await API.products_list(category_id=catalog[0]['id'], page=2)\n\n        # RUS: \u0422\u0430\u043a \u0436\u0435 \u043a\u0430\u043a \u0438 debug, \u0432 \u0440\u0430\u043d\u0442\u0430\u0439\u043c\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043d\u0430\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u043f\u0440\u043e\u043a\u0441\u0438\n        # ENG: As with debug, you can reassign the proxy in runtime\n        API.proxy = \"user:password@host:port\"\n        await API.products_list(category_id=catalog[0]['id'], page=3)\n\n\nif __name__ == '__main__':\n    asyncio.run(main())\n```\n\n### Report / \u041e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u0441\u0432\u044f\u0437\u044c\n\nIf you have any problems using it /suggestions, do not hesitate to write to the [project's GitHub](https://github.com/Open-Inflation/chizhik_api/issues)!\n\n\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 / \u043f\u043e\u0436\u0435\u043b\u0430\u043d\u0438\u044f, \u043d\u0435 \u0441\u0442\u0435\u0441\u043d\u044f\u0439\u0442\u0435\u0441\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043d\u0430 [GitHub \u043f\u0440\u043e\u0435\u043a\u0442\u0430](https://github.com/Open-Inflation/chizhik_api/issues)!\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A Python API client for Chizhik catalog",
    "version": "0.1.7",
    "project_urls": {
        "Homepage": "https://github.com/Open-Inflation/chizhik_api"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ff66f0d4e04769d6afd8b6ed210e5b313a74d381560076821b9d623a2f73ba05",
                "md5": "eef8780d5d0bed6b96a82495aac2a22c",
                "sha256": "3a15acf8e847cf602fdae7a79cac288638dd32f72301b55f367eaee1d602d1fd"
            },
            "downloads": -1,
            "filename": "chizhik_api-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "eef8780d5d0bed6b96a82495aac2a22c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 10839,
            "upload_time": "2025-04-25T21:43:54",
            "upload_time_iso_8601": "2025-04-25T21:43:54.942166Z",
            "url": "https://files.pythonhosted.org/packages/ff/66/f0d4e04769d6afd8b6ed210e5b313a74d381560076821b9d623a2f73ba05/chizhik_api-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7b11e8a031a229719a1d8963ad435869a6f877878470e74527584da67f513953",
                "md5": "4961c8f85f2e46c356ffa99f3de7dc43",
                "sha256": "9f7356e133b796514964bafe835695f446501d525352f0ccc2a824612a45f5aa"
            },
            "downloads": -1,
            "filename": "chizhik_api-0.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "4961c8f85f2e46c356ffa99f3de7dc43",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 10046,
            "upload_time": "2025-04-25T21:43:56",
            "upload_time_iso_8601": "2025-04-25T21:43:56.557657Z",
            "url": "https://files.pythonhosted.org/packages/7b/11/e8a031a229719a1d8963ad435869a6f877878470e74527584da67f513953/chizhik_api-0.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-04-25 21:43:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Open-Inflation",
    "github_project": "chizhik_api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "aiohttp",
            "specs": []
        },
        {
            "name": "camoufox",
            "specs": []
        },
        {
            "name": "snapshottest",
            "specs": [
                [
                    "~=",
                    "1.0.0a1"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": []
        },
        {
            "name": "pytest-asyncio",
            "specs": []
        },
        {
            "name": "setuptools",
            "specs": []
        }
    ],
    "lcname": "chizhik-api"
}
        
Elapsed time: 0.38700s