pyiikocloudapi - python iiko Cloud API сервис
Другие реализации
Также доступны реализации для других языков программирования:
Go: goiikoapi — реализация iiko Cloud API на языке Go
Установка
Пользуем pip:
pip install pyiikocloudapi
Зависимости
requests
pydantic
Начиная с версии 0.0.20
requests
pydantic>=2.9.2
Как использовать
Все названия методов соответствуют названию в ссылке (смотрите документацию iiko Transport).
Пример названия метода:
- /api/1/auth/ -
access_token - /api/1/order/create -
order_create
Если вам нужно чтобы ответ был в dict - то либо
api = IikoTransport(api_login, return_dict=True)
# Либо
api.return_dict = True
Example
from pyiikocloudapi import IikoTransport
from pyiikocloudapi.models import CouriersModel
# инициализация класса
api = IikoTransport(api_login)
# получаем организации получить из можно api.organizations_ids: dict or api.organizations_ids_models: OrganizationsModel
api.organizations()
# получаю список курьеров организации
couriers: CouriersModel = api.couriers(api.organizations_ids)
Пример валидации WebHook событий
from pyiikocloudapi.models import WebHookDeliveryOrderEventInfoModel
# Пример данных WebHook события
data = {
"eventType": "DeliveryOrderUpdate",
"eventTime": "2019-08-24 14:15:22.123",
"organizationId": "7bc05553-4b68-44e8-b7bc-37be63c6d9e9",
"correlationId": "48fb4cd3-2ef6-4479-bea1-7c92721b988c",
"eventInfo": {
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"posId": "7f542382-3a91-4db8-938e-e9f86b88057c",
"externalNumber": "string",
"organizationId": "7bc05553-4b68-44e8-b7bc-37be63c6d9e9",
"timestamp": 1566650122,
"creationStatus": "Success",
"errorInfo": None,
"order": {
# ... данные заказа
}
}
}
# Валидация данных WebHook
webhook_event = WebHookDeliveryOrderEventInfoModel.model_validate(data)
# Доступ к данным после валидации
print(webhook_event.event_type) # "DeliveryOrderUpdate"
print(webhook_event.organization_id) # "7bc05553-4b68-44e8-b7bc-37be63c6d9e9"
# В зависимости от event_type, event_info будет разного типа:
# - DeliveryOrderUpdate -> EventInfo
# - StopListUpdate -> EventInfoStopList
# - TableOrderError -> EventInfoTableOrder
# - ReserveUpdate / ReserveError -> EventInfoReserve
# - PersonalShift -> EventInfoPersonalShift
Каждый метод проверяет время жизни маркера доступа, если время жизни маркера прошло то будет автоматически запрошен заново.
Время жизни маркера доступа равно ~60 минутам.
###Дополнительная информация iiko Transport(iiko Cloud API) по словам разработчиков это по сути горячие хранилище без доступа к данным БД
sourceKey это "Источник заказа" из настроек в iikoWeb
Реализованные методы iiko Transport(iiko Cloud API)
- Authorization
- Notifications
- Organizations
- Terminal groups
- Dictionaries
- Menu
- Operations
- Deliveries: Create and update
- Create delivery.
- Update order problem.
- Update delivery status.
- Update order courier.
- Add order items.
- Close order.
- Cancel delivery order.
- Change time when client wants the order to be delivered.
- Change order's delivery point information.
- Change order's delivery type.
- Change order's payments.
- Change delivery comment.
- Print delivery bill.
- Confirm delivery.
- Cancel delivery confirmation.
- Assign/change the order operator.
- WebHook notification about delivery order update. Webhook ???
- WebHook notification about delivery order saving error. Webhook ???
- Deliveries: Retrieve
- Addresses
- Delivery restrictions
- Employees
- Method of obtaining drivers' coordinates history.
- Returns list of all employees which are delivery drivers in specified restaurants.
- Returns list of all employees which are delivery drivers in specified restaurants, and checks whether each employee has passed role.
- Returns list of all active (courier session is opened) courier's locations which are delivery drivers in specified restaurant and are clocked in on specified delivery terminal.
- Returns list of all active (courier session is opened) courier's locations which are delivery drivers in specified restaurants.
- Returns employee info.
- Open personal session.
- Close personal session.
- Check if personal session is open.
- Check if personal session is open.
- wMarketing sources
- Drafts
- Orders
- Banquets/reserves
- Returns all organizations of current account (determined by Authorization request header) for which banquet/reserve booking are available.
- Returns all terminal groups of specified organizations, for which banquet/reserve booking are available.
- Returns all restaurant sections of specified terminal groups, for which banquet/reserve booking are available.
- Returns all banquets/reserves for passed restaurant sections.
- Create banquet/reserve.
- Retrieve banquets/reserves statuses by IDs.
- WebHook notification about reserve update. Webhook ???
- WebHook notification about reserve saving error. Webhook ???
- Discounts and promotions
- Calculate discounts and other loyalty items for an order.
- Get all organization's manual conditions.
- Get all loyalty programs for organization.
- Get information about the specified coupon.
- Get a list of coupon series in which there are not deleted and not activated coupons.
- Get list of non-activated coupons.
- Customers
- Get customer info by specified criterion.
- Create or update customer info by id or phone or card track.
- Add new customer for program.
- Add new card for customer.
- Delete existing card for customer.
- Hold customer's money in loyalty program. Payment will be process on POS during processing of an order.
- Refill customer balance.
- Withdraw customer balance.
- ....
Metadata
Release files for pyiikocloudapi 0.0.33
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 |
|---|---|---|---|---|
| pyiikocloudapi-0.0.33.tar.gz | 31.3 kB | Without provenance | Details for pyiikocloudapi-0.0.33.tar.gz |
Release files / pyiikocloudapi-0.0.33.tar.gz
| Download URL | pyiikocloudapi-0.0.33.tar.gz |
|---|---|
| Size | 31.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c253f9444a6995e0508bb18da4cbb58fa6194e2a27358739b1e7212a971d8e77
|
|
BLAKE2b-256 checksum How to use checksums |
3437eda7aa4b5d8525955e3d4ffb6281b4922c588f1aa67960b4f9a533c5b3d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.7
|
Security for pyiikocloudapi 0.0.33
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.