Skip to main content

A Python API client for Perekrestok catalog

Project description

Perekrestok API (not official)

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

from perekrestok_api import PerekrestokAPI
from perekrestok_api import abstraction


def main():
    with PerekrestokAPI() as Api:
        geopos_handler = Api.Geolocation.current()
        geopos = geopos_handler.json()
        print(f'Текущий город сессии {geopos["content"]["city"]["name"]} ({geopos["content"]["city"]["id"]})')
    
        # Получаем список категорий
        categories = 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"]
        products = Api.Catalog.feed(filter=filter)
        prod = products.json()

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

if __name__ == "__main__":
    main()
> Текущий город сессии Москва (81)
> Список категорий: 31
> Категория: Летний сезон (1585)
> Первый товар: Пиво Василеостровское Тройной пшеничный эль нефильтрованное 6.9%, 750мл (66750)

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


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.1.8.tar.gz (17.1 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.1.8-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for perekrestok_api-0.1.8.tar.gz
Algorithm Hash digest
SHA256 1c024fef3548e867045acc5523d54e3592d2ac7c0d742672bc712762da5d0b8b
MD5 7c4c8aef3d6813e2fa71b26065fd347c
BLAKE2b-256 b4ac5572c1b157a8bb17c2a68e1679788df2f6e82e5363e319fe0d8b1583e334

See more details on using hashes here.

Provenance

The following attestation bundles were made for perekrestok_api-0.1.8.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.1.8-py3-none-any.whl.

File metadata

File hashes

Hashes for perekrestok_api-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 1ba6c28385591400858a9bfb941516f82dea05be3dea0c978f7d54544b308468
MD5 e6bf76ca7ab89dcf90bcb40732c3954a
BLAKE2b-256 8726c7ce08f7885f4dfd4094461f6101a48225cfe5e8c25e128864ca01006827

See more details on using hashes here.

Provenance

The following attestation bundles were made for perekrestok_api-0.1.8-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