An open API service indexing awesome lists of open source software.

https://github.com/open-inflation/perekrestok_api

Perekrestok API sync client
https://github.com/open-inflation/perekrestok_api

parser perekrestok playwright python3 sync

Last synced: 5 months ago
JSON representation

Perekrestok API sync client

Awesome Lists containing this project

README

          

# Perekrestok API (not official)

![Tests last run (ISO)](https://img.shields.io/badge/dynamic/json?label=Tests%20last%20run&query=%24.workflow_runs%5B0%5D.updated_at&url=https%3A%2F%2Fapi.github.com%2Frepos%2FOpen-Inflation%2Fperekrestok_api%2Factions%2Fworkflows%2Ftests.yml%2Fruns%3Fper_page%3D1%26status%3Dcompleted&logo=githubactions&cacheSeconds=300)
[![Tests](https://github.com/Open-Inflation/perekrestok_api/actions/workflows/tests.yml/badge.svg)](https://github.com/Open-Inflation/perekrestok_api/actions/workflows/tests.yml)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/perekrestok_api)
![PyPI - Package Version](https://img.shields.io/pypi/v/perekrestok_api?color=blue)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/perekrestok_api?label=PyPi%20downloads)](https://pypi.org/project/perekrestok-api/)
[![License](https://img.shields.io/github/license/Open-Inflation/perekrestok_api)](https://github.com/Open-Inflation/perekrestok_api/blob/main/LICENSE)
[![Discord](https://img.shields.io/discord/792572437292253224?label=Discord&labelColor=%232c2f33&color=%237289da)](https://discord.gg/UnJnGHNbBp)
[![Telegram](https://img.shields.io/badge/Telegram-24A1DE)](https://t.me/miskler_dev)

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

**[⭐ Star us on GitHub](https://github.com/Open-Inflation/perekrestok_api)** | **[📚 Read the Docs](https://open-inflation.github.io/perekrestok_api/quick_start)** | **[🐛 Report Bug](https://github.com/Open-Inflation/perekrestok_api/issues)**

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

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

# Usage

```bash
pip install perekrestok_api
python -m hrequests install
```

```py
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()
```
```bash
> Текущий город сессии Москва (81)
> Список категорий: 31
> Категория: Летний сезон (1585)
> Первый товар: Пиво Василеостровское Тройной пшеничный эль нефильтрованное 6.9%, 750мл (66750)
```

Для более подробной информации смотрите референсы [документации](https://open-inflation.github.io/perekrestok_api/quick_start).

---

### Report

If you have any problems using it / suggestions, do not hesitate to write to the [project's GitHub](https://github.com/Open-Inflation/perekrestok_api/issues)!