Pyaterochka API (not official)
Pyaterochka (Пятёрочка) - https://5ka.ru/
⭐ Star us on GitHub | 📚 Read the Docs | 🐛 Report Bug
Принцип работы
Библиотека полностью повторяет сетевую работу обычного пользователя на сайте.
pip install pyaterochka_api
python -m camoufox fetch
from pyaterochka_api import PyaterochkaAPI
import asyncio
from PIL import Image
async def main():
async with PyaterochkaAPI() as api:
# 1. Получение информации о текущем выбранном магазине доставки
store_info = await api.delivery_panel_store()
sap_code = store_info["selectedStore"]["sapCode"]
print(f"SAP код выбранного магазина: {sap_code}\n")
# 2. Получение списка всех категорий
tree_resp = await api.Catalog.tree(sap_code_store_id=sap_code)
categories_data = tree_resp.json()
first_category = categories_data[0]
print(f"Первая категория: {first_category['name']!s:.50s}...\n")
# 3. Получение списка товаров в первой категории
products_resp = await api.Catalog.products_list(
category_id=first_category["id"], sap_code_store_id=sap_code
)
products_data = products_resp.json()
first_product_plu = products_data["products"][0]["plu"]
print(f"Первый товар (PLU): {first_product_plu}\n")
# 4. Получение подробной информации о первом товаре
product_info_resp = await api.Catalog.Product.info(
sap_code_store_id=sap_code, plu_id=first_product_plu
)
product_info_data = product_info_resp.json()
print(f"Название первого товара: {product_info_data['name']!s:.50s}...\n")
# 5. Примеры использования геолокации
# Поиск адресов по запросу
suggest_resp = await api.Geolocation.suggest("москва")
print(f"Предложения по геолокации для 'москва': {suggest_resp.json()['results'][0]['address']['formatted_address']!s:.50s}...\n")
# Определение текущей геолокации
geocode_resp = await api.Geolocation.geocode()
pos: str = geocode_resp.json()["response"]["GeoObjectCollection"]["featureMember"][0]["GeoObject"]["Point"]["pos"]
longitude, latitude = pos.split(" ")
print(f"Выбранная геолокация (долгота, широта): {longitude}, {latitude}\n")
# 6. Скачивание изображения (на примере изображения первой подкатегории)
image_link = first_category["categories"][0]["image_link"]
image_stream = await api.General.download_image(image_link)
# Пример обработки изображения с помощью PIL
with Image.open(image_stream) as img:
print(f"Изображение скачано. Формат: {img.format}. Размер: {img.size}\n")
# img.save("first_category_image.png") # Можно сохранить локально
# Запуск асинхронной функции main
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!
Release files for pyaterochka-api 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyaterochka_api-0.2.2.tar.gz | 12.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyaterochka_api-0.2.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.0 kB
Release files / pyaterochka_api-0.2.2.tar.gz
| Download URL | pyaterochka_api-0.2.2.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fd2920e7529a854eb07e6cfb07155385912f9297310405cc5dc024f3b12a937e
|
|
BLAKE2b-256 checksum How to use checksums |
93c746ca952da7a51a5d6eec3aacfdb5cfc589e3ff596d1431c538bef02e8249
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2025.
Transparency logRelease files / pyaterochka_api-0.2.2-py3-none-any.whl
| Download URL | pyaterochka_api-0.2.2-py3-none-any.whl |
|---|---|
| Size | 13.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b031b4e9fbb72ed6f47617cc28f57d73609faabe2d9548579e59c555dd219acb
|
|
BLAKE2b-256 checksum How to use checksums |
da5b400cc21306937ef5a2e9334c6a27ae2ac8c78d0bf959af489d587b7ef460
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 15, 2025.
Transparency log