# Pyaterochka API *(not official / не официальный)*
Pyaterochka (Пятёрочка) - https://5ka.ru/
### Usage / Использование:
```py
import pyaterochka_api
import asyncio
async def main():
# RUS: Выводит список всех категорий на сайте
# ENG: Outputs a list of all categories on the site
catalog = await pyaterochka_api.categories_list(subcategories=True)
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)
# Страниц не сущетвует, использовать желаемый лимит (до 499) / Pages do not exist, use the desired limit (up to 499)
items = await pyaterochka_api.products_list(catalog[0]['id'], limit=5)
print(f"Items list output: {items!s:.100s}...\n")
# RUS: Выводит основной конфиг сайта (очень долгая функция, рекомендую сохранять в файл и переиспользовать)
# ENG: Outputs the main config of the site (large function, recommend to save in a file and re-use it)
print(f"Main config: {await pyaterochka_api.get_config()!s:.100s}...\n")
# RUS: Если требуется, можно настроить вывод логов в консоль
# ENG: If required, you can configure the output of logs in the console
pyaterochka_api.set_debug(True)
# RUS: Скачивает картинку товара (возвращает BytesIO или None)
# ENG: Downloads the product image (returns BytesIO or None)
image = await pyaterochka_api.download_image(url=items['products'][0]['image_links']['normal'][0])
with open(image.name, 'wb') as f:
f.write(image.getbuffer())
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/pyaterochka_api/issues)!
Если у вас возникнут проблемы в использовании / пожелания, не стесняйтесь писать на [GitHub проекта](https://github.com/Open-Inflation/pyaterochka_api/issues)!
Raw data
{
"_id": null,
"home_page": "https://github.com/Open-Inflation/pyaterochka_api",
"name": "pyaterochka-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/7e/3b/61f18a2ee19bb6f0ad61ca93a7546bec4cfda6cef2e34f5339f2197b5d45/pyaterochka_api-0.1.3.tar.gz",
"platform": null,
"description": "# Pyaterochka API *(not official / \u043d\u0435 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439)*\n\nPyaterochka (\u041f\u044f\u0442\u0451\u0440\u043e\u0447\u043a\u0430) - https://5ka.ru/\n\n### Usage / \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435:\n```py\nimport pyaterochka_api\nimport asyncio\n\n\nasync def main():\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 pyaterochka_api.categories_list(subcategories=True)\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 # \u0421\u0442\u0440\u0430\u043d\u0438\u0446 \u043d\u0435 \u0441\u0443\u0449\u0435\u0442\u0432\u0443\u0435\u0442, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0436\u0435\u043b\u0430\u0435\u043c\u044b\u0439 \u043b\u0438\u043c\u0438\u0442 (\u0434\u043e 499) / Pages do not exist, use the desired limit (up to 499)\n items = await pyaterochka_api.products_list(catalog[0]['id'], limit=5)\n print(f\"Items list output: {items!s:.100s}...\\n\")\n\n # RUS: \u0412\u044b\u0432\u043e\u0434\u0438\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433 \u0441\u0430\u0439\u0442\u0430 (\u043e\u0447\u0435\u043d\u044c \u0434\u043e\u043b\u0433\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0432 \u0444\u0430\u0439\u043b \u0438 \u043f\u0435\u0440\u0435\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c)\n # ENG: Outputs the main config of the site (large function, recommend to save in a file and re-use it)\n print(f\"Main config: {await pyaterochka_api.get_config()!s:.100s}...\\n\")\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\n # ENG: If required, you can configure the output of logs in the console\n pyaterochka_api.set_debug(True)\n\n # RUS: \u0421\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u0442\u043e\u0432\u0430\u0440\u0430 (\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 BytesIO \u0438\u043b\u0438 None)\n # ENG: Downloads the product image (returns BytesIO or None)\n image = await pyaterochka_api.download_image(url=items['products'][0]['image_links']['normal'][0])\n with open(image.name, 'wb') as f:\n f.write(image.getbuffer())\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/pyaterochka_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/pyaterochka_api/issues)!\n\n\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python API client for Pyaterochka store catalog",
"version": "0.1.3",
"project_urls": {
"Homepage": "https://github.com/Open-Inflation/pyaterochka_api"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7e3b61f18a2ee19bb6f0ad61ca93a7546bec4cfda6cef2e34f5339f2197b5d45",
"md5": "d337ebb0573917cf524e7debd3f164e0",
"sha256": "502af7c9d61132591c543317e2987de0026f2c7f2b7c72f5ada0c5a92af80b60"
},
"downloads": -1,
"filename": "pyaterochka_api-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "d337ebb0573917cf524e7debd3f164e0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 6339,
"upload_time": "2024-12-30T17:47:52",
"upload_time_iso_8601": "2024-12-30T17:47:52.625926Z",
"url": "https://files.pythonhosted.org/packages/7e/3b/61f18a2ee19bb6f0ad61ca93a7546bec4cfda6cef2e34f5339f2197b5d45/pyaterochka_api-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-30 17:47:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Open-Inflation",
"github_project": "pyaterochka_api",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "aiohttp",
"specs": [
[
"~=",
"3.10.11"
]
]
},
{
"name": "fake-useragent",
"specs": [
[
"~=",
"2.0.3"
]
]
},
{
"name": "tqdm",
"specs": [
[
"~=",
"4.67.1"
]
]
}
],
"lcname": "pyaterochka-api"
}