Skip to main content

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)

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


Автотесты API (pytest + snapshots)

В проекте используется автотест-фреймворк из human_requests:

  • endpoint-методы в бизнес-коде помечаются @autotest;
  • pytest-плагин сам находит эти методы и запускает их;
  • JSON-ответы проверяются через pytest-jsonschema-snapshot (schemashot);
  • параметры вызова и пост-обработка результата регистрируются в tests/endpoints/* через:
    • @autotest_params
    • @autotest_hook
    • @autotest_depends_on

Минимальная конфигурация уже включена в pyproject.toml:

[tool.pytest.ini_options]
anyio_mode = "auto"
autotest_start_class = "perekrestok_api.PerekrestokAPI"
autotest_typecheck = "strict"

Запуск тестов:

pytest

Важно:

  • используется pytest-anyio (не pytest-asyncio);
  • проверка типов аргументов @autotest_params берётся из аннотаций endpoint-методов (autotest_typecheck = "strict");
  • ручные тесты остаются только для кейсов, которые не относятся к JSON-схемам endpoint-методов (например, download_image).

Report

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

Release files for perekrestok-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)

Source distribution for perekrestok-api 0.2.2
File Size Uploaded
perekrestok_api-0.2.2.tar.gz 20.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for perekrestok-api 0.2.2
File Interpreter ABI Platform
perekrestok_api-0.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 43.0 kB

Release files / perekrestok_api-0.2.2.tar.gz

Download URL perekrestok_api-0.2.2.tar.gz
Size 20.6 kB
Tags Source
SHA-256 checksum
How to use checksums
7add999e9da7a7de552bd344e70efcfcaa076b8df2bd7d703f54a3b074be0de5
BLAKE2b-256 checksum
How to use checksums
98c015f42da51b5cf10173fb86ddb8c2aea8efa2544f37442690d99e9e8738fc
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 Feb 23, 2026.

Transparency log

Release files / perekrestok_api-0.2.2-py3-none-any.whl

Download URL perekrestok_api-0.2.2-py3-none-any.whl
Size 22.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3109fce07ef699305cf94b9122ce3c49ca95f6403aa1c9597184f95adf8eac51
BLAKE2b-256 checksum
How to use checksums
740ef159604f6cda2b8dbcf86af9ca745cfb14af5fa8cd7088a6618df471b3e5
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 Feb 23, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 release files

0.2.1

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page