Skip to main content

A Python API client for Perekrestok catalog

Project description

Perekrestok API (not official)

Tests last run (ISO) Tests PyPI - Python Version PyPI - Package Version PyPI - Downloads License Discord Telegram

Perekrestok (Перекрёсток) - https://www.perekrestok.ru/

⭐ Star us on GitHub | 📚 Read the Docs | 🐛 Report Bug

Принцип работы

Библиотека полностью повторяет сетевую работу обычного пользователя на сайте.

Usage

pip install perekrestok_api
from perekrestok_api import PerekrestokAPI
from perekrestok_api import abstraction
import asyncio


async def main():
    async with PerekrestokAPI() as Api:
        geopos_handler = await Api.Geolocation.current()
        geopos = geopos_handler.json()
        print(f'Текущий город сессии {geopos["content"]["city"]["name"]} ({geopos["content"]["city"]["id"]})')
    
        # Получаем список категорий
        categories = await Api.Catalog.tree()
        cat = categories.json()
        print(f'Список категорий: {len(cat["content"]["items"])}')

        # Выводим первую категорию
        print(f'Категория: {cat["content"]["items"][0]["category"]["title"]} ({cat["content"]["items"][0]["category"]["id"]})')
        # Получаем список товаров
        filter = abstraction.CatalogFeedFilter()
        filter.CATEGORY_ID = cat["content"]["items"][0]["category"]["id"]
        filter.PROMO_LISTING = 27
        products = await Api.Catalog.feed(filter=filter)
        prod = products.json()

        # Выводим первый товар
        print(f'Первый товар: {prod["content"]["items"][0]["title"]} ({prod["content"]["items"][0]["id"]})')

# Запуск асинхронной функции main
if __name__ == "__main__":
    asyncio.run(main())
> Текущий город сессии Москва (81)
> Список категорий: 31
> Категория: Встречаем Новый год (1692)
> Первый товар: Икра Камчатское Море горбуши зернистая солёная, 320г (487063)

Для более подробной информации смотрите референсы документации.


Report

If you have any problems using it / suggestions, do not hesitate to write to the project's GitHub!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

perekrestok_api-0.2.1.tar.gz (18.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

perekrestok_api-0.2.1-py3-none-any.whl (20.4 kB view details)

Uploaded Python 3

File details

Details for the file perekrestok_api-0.2.1.tar.gz.

File metadata

  • Download URL: perekrestok_api-0.2.1.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for perekrestok_api-0.2.1.tar.gz
Algorithm Hash digest
SHA256 7178aee433c031bee24c59cd58a2226d92d70f7e240d69e40150361d8f8fbedd
MD5 50c88e6f7633cb690250084252324f53
BLAKE2b-256 528a9866694066f1c5c61b0f4948a3eeb38d27ce4d4cb2b1a2aa47c821ad0c03

See more details on using hashes here.

Provenance

The following attestation bundles were made for perekrestok_api-0.2.1.tar.gz:

Publisher: publish.yml on Open-Inflation/perekrestok_api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file perekrestok_api-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for perekrestok_api-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4e1ac0134e784913fa62aa81ce93a022acc2aee3bdff937e5899d7cbc5d0e30d
MD5 55b5efcabf884e0a7e784b04b785ebd4
BLAKE2b-256 60408d87acc10d1872813f120e3e3fb85037e7cf137255ed0af6c7145d98b941

See more details on using hashes here.

Provenance

The following attestation bundles were made for perekrestok_api-0.2.1-py3-none-any.whl:

Publisher: publish.yml on Open-Inflation/perekrestok_api

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page