Pyiiko 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- Pyiiko/__init__.py +15 -0
- Pyiiko/_base.py +83 -0
- Pyiiko/_server_nomenclature.py +288 -0
- Pyiiko/_web_docs.py +534 -0
- Pyiiko/exceptions.py +18 -0
- Pyiiko/iiko_web.py +392 -0
- Pyiiko/py.typed +0 -0
- Pyiiko/server.py +637 -0
- Pyiiko/transport.py +203 -0
- pyiiko-0.4.0.dist-info/METADATA +344 -0
- pyiiko-0.4.0.dist-info/RECORD +14 -0
- pyiiko-0.4.0.dist-info/WHEEL +5 -0
- pyiiko-0.4.0.dist-info/licenses/LICENSE +201 -0
- pyiiko-0.4.0.dist-info/top_level.txt +1 -0
Pyiiko/transport.py
ADDED
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
"""iiko Transport (Cloud) API client."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import logging
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from ._base import DEFAULT_TIMEOUT, BaseIikoClient
|
|
8
|
+
from .exceptions import IikoAuthError
|
|
9
|
+
|
|
10
|
+
logger = logging.getLogger(__name__)
|
|
11
|
+
|
|
12
|
+
_API_BASE = "https://api-ru.iiko.services"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class Transport(BaseIikoClient):
|
|
16
|
+
"""Client for the iiko Transport Cloud API.
|
|
17
|
+
|
|
18
|
+
Authenticates with an API login key and stores a Bearer token for
|
|
19
|
+
subsequent requests::
|
|
20
|
+
|
|
21
|
+
client = Transport(key="your-api-login-key")
|
|
22
|
+
orgs = client.organization()
|
|
23
|
+
|
|
24
|
+
Pass a pre-fetched *token* dict to skip the auth round-trip::
|
|
25
|
+
|
|
26
|
+
client = Transport(token={"token": "...", ...})
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
def __init__(
|
|
30
|
+
self,
|
|
31
|
+
key: str | None = None,
|
|
32
|
+
token: dict | None = None,
|
|
33
|
+
timeout: int = DEFAULT_TIMEOUT,
|
|
34
|
+
) -> None:
|
|
35
|
+
super().__init__(_API_BASE, timeout)
|
|
36
|
+
self.key = key
|
|
37
|
+
self._token: dict = token if token is not None else self.get_token()
|
|
38
|
+
|
|
39
|
+
# ------------------------------------------------------------------
|
|
40
|
+
# Auth
|
|
41
|
+
# ------------------------------------------------------------------
|
|
42
|
+
|
|
43
|
+
def get_token(self) -> dict:
|
|
44
|
+
"""Fetch a new Bearer token using the API login key.
|
|
45
|
+
|
|
46
|
+
:returns: Token response dict, e.g. ``{"token": "...", "correlationId": "..."}``.
|
|
47
|
+
:raises IikoAuthError: If the server returns an empty token.
|
|
48
|
+
"""
|
|
49
|
+
response = self._post(
|
|
50
|
+
"api/1/access_token",
|
|
51
|
+
json={"apiLogin": self.key},
|
|
52
|
+
headers={"content-type": "application/json", "Accept-Charset": "UTF-8"},
|
|
53
|
+
)
|
|
54
|
+
data: dict = response.json()
|
|
55
|
+
if not data.get("token"):
|
|
56
|
+
raise IikoAuthError("Transport API returned an empty token")
|
|
57
|
+
return data
|
|
58
|
+
|
|
59
|
+
def token(self) -> dict:
|
|
60
|
+
"""Return the current token response dict."""
|
|
61
|
+
return self._token
|
|
62
|
+
|
|
63
|
+
def _auth(self) -> dict[str, str]:
|
|
64
|
+
"""Return Authorization header for the current token."""
|
|
65
|
+
return {"Authorization": f"Bearer {self._token['token']}"}
|
|
66
|
+
|
|
67
|
+
# ------------------------------------------------------------------
|
|
68
|
+
# Organizations & infrastructure
|
|
69
|
+
# ------------------------------------------------------------------
|
|
70
|
+
|
|
71
|
+
def organization(self) -> Any:
|
|
72
|
+
"""Return the list of organizations accessible with the current key."""
|
|
73
|
+
return self._get("api/1/organizations", headers=self._auth())
|
|
74
|
+
|
|
75
|
+
def terminal(self, org_id: str, include: str = "false") -> Any:
|
|
76
|
+
"""Return terminal groups for an organization.
|
|
77
|
+
|
|
78
|
+
:param org_id: Organization GUID.
|
|
79
|
+
:param include: Whether to include disabled groups (default ``"false"``).
|
|
80
|
+
"""
|
|
81
|
+
return self._post(
|
|
82
|
+
"api/1/terminal_groups",
|
|
83
|
+
json={"organizationIds": [org_id]},
|
|
84
|
+
headers=self._auth(),
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
def regions(self, org_id: str) -> Any:
|
|
88
|
+
"""Return delivery regions for an organization.
|
|
89
|
+
|
|
90
|
+
:param org_id: Organization GUID.
|
|
91
|
+
"""
|
|
92
|
+
return self._post(
|
|
93
|
+
"api/1/regions",
|
|
94
|
+
json={"organizationIds": [org_id]},
|
|
95
|
+
headers=self._auth(),
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
def cities(self, org_id: str | None = None) -> Any:
|
|
99
|
+
"""Return cities for an organization.
|
|
100
|
+
|
|
101
|
+
:param org_id: Organization GUID.
|
|
102
|
+
"""
|
|
103
|
+
return self._post(
|
|
104
|
+
"api/1/cities",
|
|
105
|
+
json={"organizationIds": [org_id]},
|
|
106
|
+
headers=self._auth(),
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
def streets_by_city(self, org_id: str, city: str) -> Any:
|
|
110
|
+
"""Return streets for a city within an organization.
|
|
111
|
+
|
|
112
|
+
:param org_id: Organization GUID.
|
|
113
|
+
:param city: City GUID.
|
|
114
|
+
"""
|
|
115
|
+
return self._post(
|
|
116
|
+
"api/1/streets/by_city",
|
|
117
|
+
json={"organizationId": org_id, "cityId": city},
|
|
118
|
+
headers=self._auth(),
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
# ------------------------------------------------------------------
|
|
122
|
+
# Deliveries
|
|
123
|
+
# ------------------------------------------------------------------
|
|
124
|
+
|
|
125
|
+
def delivery_create(self, order_info: dict) -> Any:
|
|
126
|
+
"""Create a delivery order.
|
|
127
|
+
|
|
128
|
+
:param order_info: Delivery order payload dict.
|
|
129
|
+
"""
|
|
130
|
+
return self._post(
|
|
131
|
+
"api/1/deliveries/create",
|
|
132
|
+
json=order_info,
|
|
133
|
+
headers=self._auth(),
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
def check_create(self, order_info: dict | str) -> Any:
|
|
137
|
+
"""Validate a delivery order before creation.
|
|
138
|
+
|
|
139
|
+
:param order_info: Order payload as dict or JSON string.
|
|
140
|
+
"""
|
|
141
|
+
import json
|
|
142
|
+
|
|
143
|
+
payload = (
|
|
144
|
+
order_info
|
|
145
|
+
if isinstance(order_info, dict)
|
|
146
|
+
else json.loads(order_info)
|
|
147
|
+
)
|
|
148
|
+
return self._post(
|
|
149
|
+
"api/1/deliveries/check_create",
|
|
150
|
+
json=payload,
|
|
151
|
+
headers=self._auth(),
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
def by_id(
|
|
155
|
+
self,
|
|
156
|
+
org_id: str | None = None,
|
|
157
|
+
order_id: str | None = None,
|
|
158
|
+
) -> Any:
|
|
159
|
+
"""Return a delivery order by ID.
|
|
160
|
+
|
|
161
|
+
:param org_id: Organization GUID.
|
|
162
|
+
:param order_id: Order GUID.
|
|
163
|
+
"""
|
|
164
|
+
return self._post(
|
|
165
|
+
"api/1/deliveries/by_id",
|
|
166
|
+
json={"organizationId": org_id, "orderIds": [order_id]},
|
|
167
|
+
headers=self._auth(),
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
def by_delivery_date(
|
|
171
|
+
self,
|
|
172
|
+
org_id: str | None = None,
|
|
173
|
+
delivery_date_from: str | None = None,
|
|
174
|
+
) -> Any:
|
|
175
|
+
"""Return deliveries filtered by date and status.
|
|
176
|
+
|
|
177
|
+
:param org_id: Organization GUID.
|
|
178
|
+
:param delivery_date_from: Start date-time ISO.
|
|
179
|
+
"""
|
|
180
|
+
return self._post(
|
|
181
|
+
"api/1/deliveries/by_delivery_date_and_status",
|
|
182
|
+
json={
|
|
183
|
+
"organizationId": [org_id],
|
|
184
|
+
"deliveryDateFrom": [delivery_date_from],
|
|
185
|
+
},
|
|
186
|
+
headers=self._auth(),
|
|
187
|
+
)
|
|
188
|
+
|
|
189
|
+
def by_revision(
|
|
190
|
+
self,
|
|
191
|
+
org_id: str | None = None,
|
|
192
|
+
revision: str | None = None,
|
|
193
|
+
) -> Any:
|
|
194
|
+
"""Return deliveries starting from a revision number.
|
|
195
|
+
|
|
196
|
+
:param org_id: Organization GUID.
|
|
197
|
+
:param revision: Start revision (string).
|
|
198
|
+
"""
|
|
199
|
+
return self._post(
|
|
200
|
+
"api/1/deliveries/by_revision",
|
|
201
|
+
json={"startRevision": revision, "organizationIds": [org_id]},
|
|
202
|
+
headers=self._auth(),
|
|
203
|
+
)
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: Pyiiko
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Python library for iiko ERP API
|
|
5
|
+
Author-email: Gadzhibala Pirmagomedov <gadzhibala@protonmail.com>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/gadzhi/pyiiko
|
|
8
|
+
Project-URL: Repository, https://github.com/gadzhi/pyiiko
|
|
9
|
+
Project-URL: Issues, https://github.com/gadzhi/pyiiko/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/gadzhi/pyiiko/blob/master/CHANGELOG.md
|
|
11
|
+
Keywords: iiko,restaurant,erp,api,horeca
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Classifier: Typing :: Typed
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: requests>=2.28.0
|
|
25
|
+
Requires-Dist: lxml>=4.9.0
|
|
26
|
+
Requires-Dist: urllib3>=1.26.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=7.4; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-cov>=4.1; extra == "dev"
|
|
30
|
+
Requires-Dist: responses>=0.23.0; extra == "dev"
|
|
31
|
+
Requires-Dist: ruff>=0.4.0; extra == "dev"
|
|
32
|
+
Requires-Dist: mypy>=1.9; extra == "dev"
|
|
33
|
+
Requires-Dist: types-requests>=2.31; extra == "dev"
|
|
34
|
+
Requires-Dist: lxml-stubs>=0.5; extra == "dev"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
<p align="center">
|
|
38
|
+
<img src="https://habrastorage.org/webt/bi/od/mp/biodmpylxpnkxhjtewsjro_-8ps.jpeg" height="160" alt="pyiiko">
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
<h1 align="center">pyiiko</h1>
|
|
42
|
+
|
|
43
|
+
<p align="center">Python-библиотека для работы с API iiko ERP</p>
|
|
44
|
+
|
|
45
|
+
<p align="center">
|
|
46
|
+
<a href="https://pypi.org/project/Pyiiko/"><img src="https://img.shields.io/pypi/v/Pyiiko?color=blue" alt="PyPI version"></a>
|
|
47
|
+
<a href="https://pypi.org/project/Pyiiko/"><img src="https://img.shields.io/pypi/pyversions/Pyiiko" alt="Python versions"></a>
|
|
48
|
+
<a href="https://pypi.org/project/Pyiiko/"><img src="https://img.shields.io/pypi/dm/Pyiiko?color=green" alt="PyPI downloads"></a>
|
|
49
|
+
<a href="https://www.apache.org/licenses/LICENSE-2.0"><img src="https://img.shields.io/pypi/l/Pyiiko" alt="License: Apache 2.0"></a>
|
|
50
|
+
</p>
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Возможности
|
|
55
|
+
|
|
56
|
+
- **iiko Server API** — on-premise установки (складской учёт, номенклатура, отчёты OLAP, сотрудники, накладные, EDI)
|
|
57
|
+
- **iiko Transport API** — облачный API (организации, терминалы, доставки, города, улицы)
|
|
58
|
+
- **iiko Public Web API** — облачный API нового поколения (документооборот, номенклатура, закупки)
|
|
59
|
+
- Автоматический retry на 5xx ошибки (3 попытки с backoff)
|
|
60
|
+
- Единая иерархия исключений: `IikoError` → `IikoAuthError` / `IikoAPIError`
|
|
61
|
+
- Context manager для автоматического освобождения ресурсов
|
|
62
|
+
- Type hints, PEP 561 `py.typed`
|
|
63
|
+
|
|
64
|
+
## Установка
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install Pyiiko
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**Требования:** Python 3.9+
|
|
71
|
+
|
|
72
|
+
## Быстрый старт
|
|
73
|
+
|
|
74
|
+
### iiko Server (on-premise)
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from Pyiiko import IikoServer
|
|
78
|
+
|
|
79
|
+
# Пароль передаётся в виде SHA1-хеша
|
|
80
|
+
server = IikoServer(
|
|
81
|
+
ip="https://your-server.example.com:443",
|
|
82
|
+
login="login",
|
|
83
|
+
password="da39a3ee5e6b4b0d3255bfef95601890afd80709",
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
print(server.version()) # "7.8.9"
|
|
87
|
+
print(server.departments()) # XML с иерархией подразделений
|
|
88
|
+
print(server.products()) # XML с номенклатурой
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Использование как context manager освобождает токен (лицензионный слот) автоматически:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
with IikoServer(ip="...", login="...", password="...") as server:
|
|
95
|
+
stores = server.stores()
|
|
96
|
+
employees = server.employees()
|
|
97
|
+
# токен уничтожен, лицензия освобождена
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Если токен уже получен — передайте его напрямую, чтобы не делать лишний запрос:
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
server = IikoServer(ip="https://...", token="your-existing-token")
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### iiko Public Web API
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
from Pyiiko import IikoWeb
|
|
110
|
+
|
|
111
|
+
client = IikoWeb(api_key="your-api-key")
|
|
112
|
+
|
|
113
|
+
# Список складов
|
|
114
|
+
stores = client.stores()
|
|
115
|
+
|
|
116
|
+
# Список продуктов с пагинацией
|
|
117
|
+
products = client.products(limit=100, offset=0)
|
|
118
|
+
|
|
119
|
+
# Экспорт приходных накладных
|
|
120
|
+
invoices = client.incoming_invoice_export(
|
|
121
|
+
department_id="dept-guid-...",
|
|
122
|
+
date_from="2024-01-01",
|
|
123
|
+
date_to="2024-01-31",
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
# Список заказов на закупку
|
|
127
|
+
orders = client.orders_list({"storeId": 1, "limit": 50})
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Передайте уже полученный токен, чтобы пропустить авторизацию:
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
client = IikoWeb(token={"token": "eyJ...", "expires_in": 9999999999})
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### iiko Transport (Cloud)
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
from Pyiiko import Transport
|
|
140
|
+
|
|
141
|
+
client = Transport(key="your-api-login-key")
|
|
142
|
+
|
|
143
|
+
orgs = client.organization()
|
|
144
|
+
terminals = client.terminal(org_id="org-guid-...")
|
|
145
|
+
cities = client.cities(org_id="org-guid-...")
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Создание доставки:
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
order = {
|
|
152
|
+
"organizationId": "org-guid-...",
|
|
153
|
+
"order": {
|
|
154
|
+
"phone": "+79001234567",
|
|
155
|
+
"deliveryPoint": {"coordinates": {"latitude": 55.75, "longitude": 37.61}},
|
|
156
|
+
"items": [{"productId": "product-guid-...", "amount": 1}],
|
|
157
|
+
},
|
|
158
|
+
}
|
|
159
|
+
response = client.delivery_create(order_info=order)
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Обработка ошибок
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
from Pyiiko import IikoServer, IikoAuthError, IikoAPIError
|
|
166
|
+
|
|
167
|
+
try:
|
|
168
|
+
server = IikoServer(ip="...", login="user", password="wrong")
|
|
169
|
+
except IikoAuthError:
|
|
170
|
+
print("Неверные учётные данные")
|
|
171
|
+
|
|
172
|
+
try:
|
|
173
|
+
data = server.departments()
|
|
174
|
+
except IikoAPIError as e:
|
|
175
|
+
print(f"Ошибка API: HTTP {e.status_code}")
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
| Исключение | Когда возникает |
|
|
179
|
+
|---|---|
|
|
180
|
+
| `IikoError` | Базовый класс всех ошибок pyiiko |
|
|
181
|
+
| `IikoAuthError` | Неверный логин/пароль, пустой токен |
|
|
182
|
+
| `IikoAPIError` | Сервер вернул HTTP 4xx/5xx |
|
|
183
|
+
|
|
184
|
+
## Справочник методов
|
|
185
|
+
|
|
186
|
+
### `IikoServer`
|
|
187
|
+
|
|
188
|
+
| Метод | Описание |
|
|
189
|
+
|---|---|
|
|
190
|
+
| `version()` | Версия iiko сервера |
|
|
191
|
+
| `server_info()` | Информация о сервере и лицензии |
|
|
192
|
+
| `departments()` | Иерархия подразделений |
|
|
193
|
+
| `stores()` | Список складов |
|
|
194
|
+
| `groups()` | Группы и отделения |
|
|
195
|
+
| `terminals()` | Список терминалов |
|
|
196
|
+
| `terminals_search(anonymous, **kwargs)` | Поиск терминалов |
|
|
197
|
+
| `employees()` | Сотрудники |
|
|
198
|
+
| `products(includeDeleted)` | Номенклатура |
|
|
199
|
+
| `products_find(**kwargs)` | Поиск по номенклатуре |
|
|
200
|
+
| `suppliers()` | Поставщики |
|
|
201
|
+
| `suppliers_find(name, code)` | Поиск поставщиков |
|
|
202
|
+
| `suppliers_price(code, date)` | Прайс-лист поставщика |
|
|
203
|
+
| `events(**kwargs)` | События |
|
|
204
|
+
| `events_filter(body)` | События по фильтру XML |
|
|
205
|
+
| `olap(report, data_from, data_to, **kwargs)` | OLAP-отчёт v1 |
|
|
206
|
+
| `olap2(body)` | OLAP-отчёт v2 (JSON) |
|
|
207
|
+
| `sales(departament, **kwargs)` | Отчёт по выручке |
|
|
208
|
+
| `product_expense(departament, **kwargs)` | Расход продуктов |
|
|
209
|
+
| `store_operation(**kwargs)` | Складские операции |
|
|
210
|
+
| `reports_balance(timestamp, **kwargs)` | Балансы по счетам |
|
|
211
|
+
| `invoice_in(**kwargs)` | Приходные накладные |
|
|
212
|
+
| `invoice_out(**kwargs)` | Расходные накладные |
|
|
213
|
+
| `invoice_number_in(current_year, **kwargs)` | Приходная накладная по номеру |
|
|
214
|
+
| `invoice_number_out(current_year, **kwargs)` | Расходная накладная по номеру |
|
|
215
|
+
| `production_doc(xml)` | Загрузка акта приготовления |
|
|
216
|
+
| `close_session(dateFrom, dateTo)` | Кассовые смены |
|
|
217
|
+
| `edi(edi, **kwargs)` | EDI заказы |
|
|
218
|
+
| `quit_token()` | Уничтожить токен / освободить лицензию |
|
|
219
|
+
|
|
220
|
+
### `Transport`
|
|
221
|
+
|
|
222
|
+
| Метод | Описание |
|
|
223
|
+
|---|---|
|
|
224
|
+
| `organization()` | Список организаций |
|
|
225
|
+
| `terminal(org_id)` | Терминальные группы |
|
|
226
|
+
| `regions(org_id)` | Регионы доставки |
|
|
227
|
+
| `cities(org_id)` | Города |
|
|
228
|
+
| `streets_by_city(org_id, city)` | Улицы города |
|
|
229
|
+
| `delivery_create(order_info)` | Создать доставку |
|
|
230
|
+
| `check_create(order_info)` | Валидировать заказ перед созданием |
|
|
231
|
+
| `by_id(org_id, order_id)` | Доставка по ID |
|
|
232
|
+
| `by_delivery_date(org_id, delivery_date_from)` | Доставки по дате |
|
|
233
|
+
| `by_revision(org_id, revision)` | Доставки с ревизии |
|
|
234
|
+
|
|
235
|
+
### `IikoWeb`
|
|
236
|
+
|
|
237
|
+
#### Авторизация
|
|
238
|
+
|
|
239
|
+
| Метод | Описание |
|
|
240
|
+
|---|---|
|
|
241
|
+
| `get_token()` | Получить новый Bearer-токен по API-ключу |
|
|
242
|
+
| `token()` | Вернуть текущий токен (dict) |
|
|
243
|
+
|
|
244
|
+
#### Справочники (entities)
|
|
245
|
+
|
|
246
|
+
| Метод | Описание |
|
|
247
|
+
|---|---|
|
|
248
|
+
| `stores()` | Список складов |
|
|
249
|
+
| `store(store_id)` | Склад по ID |
|
|
250
|
+
| `products(filters, limit, offset)` | Номенклатура |
|
|
251
|
+
| `product_categories(filters, limit, offset)` | Категории продуктов |
|
|
252
|
+
| `product_sizes(filters, limit, offset)` | Размеры продуктов |
|
|
253
|
+
| `users(filters, limit, offset)` | Пользователи |
|
|
254
|
+
| `payment_types(filters, limit, offset)` | Типы оплат |
|
|
255
|
+
| `cash_flow_categories(filters, limit, offset)` | Статьи ДДС |
|
|
256
|
+
|
|
257
|
+
#### Номенклатура
|
|
258
|
+
|
|
259
|
+
| Метод | Описание |
|
|
260
|
+
|---|---|
|
|
261
|
+
| `update_barcodes(payload)` | Обновить штрих-коды |
|
|
262
|
+
|
|
263
|
+
#### Документооборот
|
|
264
|
+
|
|
265
|
+
| Метод | Описание |
|
|
266
|
+
|---|---|
|
|
267
|
+
| `counteragents(department_id, type, limit, offset)` | Список контрагентов |
|
|
268
|
+
| `incoming_invoice_create(payload)` | Создать приходную накладную |
|
|
269
|
+
| `incoming_invoice_export(department_id, date_from, date_to, ...)` | Экспорт приходных накладных |
|
|
270
|
+
| `incoming_invoice_export_by_number(payload)` | Приходная накладная по номеру |
|
|
271
|
+
| `incoming_invoice_pay(payload)` | Провести оплату приходной накладной |
|
|
272
|
+
| `incoming_invoice_set_payment_date(payload)` | Установить дату оплаты |
|
|
273
|
+
| `incoming_invoice_update(payload)` | Обновить приходную накладную |
|
|
274
|
+
| `incoming_service_create(payload)` | Создать акт входящих услуг |
|
|
275
|
+
| `incoming_service_edit(payload)` | Изменить акт входящих услуг |
|
|
276
|
+
| `incoming_service_export(payload)` | Экспорт актов входящих услуг |
|
|
277
|
+
| `incoming_service_get(payload)` | Получить акт входящих услуг |
|
|
278
|
+
| `internal_transfer_create(payload)` | Создать внутреннее перемещение |
|
|
279
|
+
| `internal_transfer_edit(payload)` | Изменить внутреннее перемещение |
|
|
280
|
+
| `internal_transfer_export(payload)` | Экспорт внутренних перемещений |
|
|
281
|
+
| `internal_transfer_get_by_id(payload)` | Перемещение по ID |
|
|
282
|
+
| `internal_transfer_export_by_number(payload)` | Перемещение по номеру |
|
|
283
|
+
| `outgoing_invoice_create(payload)` | Создать расходную накладную |
|
|
284
|
+
| `outgoing_invoice_export(payload)` | Экспорт расходных накладных |
|
|
285
|
+
| `outgoing_invoice_export_by_number(payload)` | Расходная накладная по номеру |
|
|
286
|
+
| `outgoing_invoice_cost_prices(payload)` | Себестоимость по расходной накладной |
|
|
287
|
+
| `outgoing_invoice_pay(payload)` | Провести оплату расходной накладной |
|
|
288
|
+
| `outgoing_invoice_set_payment_date(payload)` | Установить дату оплаты |
|
|
289
|
+
| `outgoing_invoice_update(payload)` | Обновить расходную накладную |
|
|
290
|
+
| `outgoing_service_create(payload)` | Создать акт исходящих услуг |
|
|
291
|
+
| `outgoing_service_edit(payload)` | Изменить акт исходящих услуг |
|
|
292
|
+
| `outgoing_service_export(payload)` | Экспорт актов исходящих услуг |
|
|
293
|
+
| `outgoing_service_get(payload)` | Получить акт исходящих услуг |
|
|
294
|
+
| `production_doc_create(payload)` | Создать акт приготовления |
|
|
295
|
+
| `production_doc_edit(payload)` | Изменить акт приготовления |
|
|
296
|
+
| `production_doc_export(payload)` | Экспорт актов приготовления |
|
|
297
|
+
| `production_doc_get(payload)` | Получить акт приготовления |
|
|
298
|
+
| `sales_doc_create(payload)` | Создать акт реализации |
|
|
299
|
+
| `sales_doc_edit(payload)` | Изменить акт реализации |
|
|
300
|
+
| `sales_doc_export(payload)` | Экспорт актов реализации |
|
|
301
|
+
| `sales_doc_get(payload)` | Получить акт реализации |
|
|
302
|
+
| `writeoff_create(payload)` | Создать акт списания |
|
|
303
|
+
| `writeoff_edit(payload)` | Изменить акт списания |
|
|
304
|
+
| `writeoff_export(payload)` | Экспорт актов списания |
|
|
305
|
+
| `writeoff_get_by_id(payload)` | Акт списания по ID |
|
|
306
|
+
| `writeoff_export_by_number(payload)` | Акт списания по номеру |
|
|
307
|
+
|
|
308
|
+
#### Закупки
|
|
309
|
+
|
|
310
|
+
| Метод | Описание |
|
|
311
|
+
|---|---|
|
|
312
|
+
| `order_create(store_id, workflow_id, due_date, ...)` | Создать заказ на закупку |
|
|
313
|
+
| `order_get(order_id)` | Заказ на закупку по ID |
|
|
314
|
+
| `orders_list(payload)` | Список заказов на закупку |
|
|
315
|
+
| `order_add_products(payload)` | Добавить продукты в заказ |
|
|
316
|
+
| `order_select_supplier(payload)` | Выбрать поставщика для заказа |
|
|
317
|
+
| `order_task_status(task_id)` | Статус асинхронной задачи заказа |
|
|
318
|
+
| `order_select_units(payload)` | Выбрать единицы измерения для заказа |
|
|
319
|
+
| `workflow_activate(workflow_id)` | Активировать рабочий процесс |
|
|
320
|
+
| `workflow_deactivate(workflow_id)` | Деактивировать рабочий процесс |
|
|
321
|
+
| `workflow_get(workflow_id)` | Рабочий процесс по ID |
|
|
322
|
+
| `workflows_list(payload)` | Список рабочих процессов |
|
|
323
|
+
|
|
324
|
+
## Разработка
|
|
325
|
+
|
|
326
|
+
```bash
|
|
327
|
+
git clone https://github.com/gadzhi/pyiiko.git
|
|
328
|
+
cd pyiiko
|
|
329
|
+
python -m venv .venv && source .venv/bin/activate
|
|
330
|
+
pip install -e ".[dev]"
|
|
331
|
+
pytest --cov=Pyiiko
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Тесты не требуют подключения к серверу — HTTP замокан через `responses`.
|
|
335
|
+
|
|
336
|
+
Подробности в [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
337
|
+
|
|
338
|
+
## Changelog
|
|
339
|
+
|
|
340
|
+
Смотрите [CHANGELOG.md](CHANGELOG.md).
|
|
341
|
+
|
|
342
|
+
## Лицензия
|
|
343
|
+
|
|
344
|
+
[Apache License 2.0](LICENSE)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Pyiiko/__init__.py,sha256=slzbwPw9412ySjEKk8AQjGuPu1I0ZH61FholumRW1hk,352
|
|
2
|
+
Pyiiko/_base.py,sha256=-qKRHZJqTG3uj0gjpRsoq0bPCY-G4q9P8orZhUIP20E,2645
|
|
3
|
+
Pyiiko/_server_nomenclature.py,sha256=7UdAJrUsSZd1034_oVyomKMt_lpExskpMsnr4mwKF2I,10605
|
|
4
|
+
Pyiiko/_web_docs.py,sha256=Xnxm2UdtZldxGfJE00XvOoHq0NBsTBRlt37V-kwYamw,16799
|
|
5
|
+
Pyiiko/exceptions.py,sha256=OaybNOGjX3zcj4UWKy4vM25bz-YFsy9czzzPQpwXZC0,510
|
|
6
|
+
Pyiiko/iiko_web.py,sha256=C5hqB4EBwUAueU5LWhHlJAOT2a_7VACjXbj8YqVsv4w,12234
|
|
7
|
+
Pyiiko/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
Pyiiko/server.py,sha256=CTDQRTDLOgtoDF-vip4McNYWWPdMhK1HyQTfFqBV6QY,22436
|
|
9
|
+
Pyiiko/transport.py,sha256=DmPMqmUe-amf9s85yNptL0AfCn5GtVuNt3EdxSY5btM,6275
|
|
10
|
+
pyiiko-0.4.0.dist-info/licenses/LICENSE,sha256=ae_961slqcUgjwz7yVr19cTBZnRS78MYhAF7sO25rKQ,11353
|
|
11
|
+
pyiiko-0.4.0.dist-info/METADATA,sha256=YuGlhqpLcGR00HiJ2KrDj2wPkOEmJ8502Ez2RwMXA2w,15389
|
|
12
|
+
pyiiko-0.4.0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
13
|
+
pyiiko-0.4.0.dist-info/top_level.txt,sha256=0_znCwde_ywZ9U1FmAZcx0kWn7JXKHvk8HozdGd50Io,7
|
|
14
|
+
pyiiko-0.4.0.dist-info/RECORD,,
|