A Python API client for Perekrestok catalog
Project description
Perekrestok API (not official)
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7178aee433c031bee24c59cd58a2226d92d70f7e240d69e40150361d8f8fbedd
|
|
| MD5 |
50c88e6f7633cb690250084252324f53
|
|
| BLAKE2b-256 |
528a9866694066f1c5c61b0f4948a3eeb38d27ce4d4cb2b1a2aa47c821ad0c03
|
Provenance
The following attestation bundles were made for perekrestok_api-0.2.1.tar.gz:
Publisher:
publish.yml on Open-Inflation/perekrestok_api
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
perekrestok_api-0.2.1.tar.gz -
Subject digest:
7178aee433c031bee24c59cd58a2226d92d70f7e240d69e40150361d8f8fbedd - Sigstore transparency entry: 725053804
- Sigstore integration time:
-
Permalink:
Open-Inflation/perekrestok_api@e4d1d960a13c403c3cf0134c147d9aca929d29c1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Open-Inflation
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e4d1d960a13c403c3cf0134c147d9aca929d29c1 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file perekrestok_api-0.2.1-py3-none-any.whl.
File metadata
- Download URL: perekrestok_api-0.2.1-py3-none-any.whl
- Upload date:
- Size: 20.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e1ac0134e784913fa62aa81ce93a022acc2aee3bdff937e5899d7cbc5d0e30d
|
|
| MD5 |
55b5efcabf884e0a7e784b04b785ebd4
|
|
| BLAKE2b-256 |
60408d87acc10d1872813f120e3e3fb85037e7cf137255ed0af6c7145d98b941
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
perekrestok_api-0.2.1-py3-none-any.whl -
Subject digest:
4e1ac0134e784913fa62aa81ce93a022acc2aee3bdff937e5899d7cbc5d0e30d - Sigstore transparency entry: 725053808
- Sigstore integration time:
-
Permalink:
Open-Inflation/perekrestok_api@e4d1d960a13c403c3cf0134c147d9aca929d29c1 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Open-Inflation
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e4d1d960a13c403c3cf0134c147d9aca929d29c1 -
Trigger Event:
workflow_dispatch
-
Statement type: