Perekrestok API (not official)
Perekrestok (Перекрёсток) - https://www.perekrestok.ru/
⭐ Star us on GitHub | 📚 Read the Docs | 🐛 Report Bug
Принцип работы
Библиотека полностью повторяет сетевую работу обычного пользователя на сайте.
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!
Metadata
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| perekrestok_api-0.2.2.tar.gz | 20.6 kB | With provenance | Details for perekrestok_api-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| perekrestok_api-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for perekrestok_api-0.2.2-py3-none-any.whl |
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 logRelease 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 logSecurity for perekrestok-api 0.2.2
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for perekrestok_api-0.2.2.tar.gz
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 logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.