nccgest 0.1.0__tar.gz

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.
Files changed (30) hide show
  1. nccgest-0.1.0/.gitignore +16 -0
  2. nccgest-0.1.0/LICENSE +21 -0
  3. nccgest-0.1.0/PKG-INFO +172 -0
  4. nccgest-0.1.0/README.it.md +87 -0
  5. nccgest-0.1.0/README.md +123 -0
  6. nccgest-0.1.0/README.ru.md +91 -0
  7. nccgest-0.1.0/docs/library_api.ru.md +282 -0
  8. nccgest-0.1.0/pyproject.toml +87 -0
  9. nccgest-0.1.0/src/nccgest/__init__.py +14 -0
  10. nccgest-0.1.0/src/nccgest/client.py +230 -0
  11. nccgest-0.1.0/src/nccgest/exceptions.py +29 -0
  12. nccgest-0.1.0/src/nccgest/mock_service/__init__.py +7 -0
  13. nccgest-0.1.0/src/nccgest/mock_service/__main__.py +19 -0
  14. nccgest-0.1.0/src/nccgest/mock_service/app.py +313 -0
  15. nccgest-0.1.0/src/nccgest/mock_service/seed.py +48 -0
  16. nccgest-0.1.0/src/nccgest/mock_service/settings.py +40 -0
  17. nccgest-0.1.0/src/nccgest/mock_service/static/style.css +8 -0
  18. nccgest-0.1.0/src/nccgest/mock_service/storage.py +453 -0
  19. nccgest-0.1.0/src/nccgest/mock_service/templates/_admin_header.html +10 -0
  20. nccgest-0.1.0/src/nccgest/mock_service/templates/base.html +16 -0
  21. nccgest-0.1.0/src/nccgest/mock_service/templates/driver_edit.html +50 -0
  22. nccgest-0.1.0/src/nccgest/mock_service/templates/drivers_list.html +35 -0
  23. nccgest-0.1.0/src/nccgest/mock_service/templates/login.html +19 -0
  24. nccgest-0.1.0/src/nccgest/mock_service/templates/service_edit.html +66 -0
  25. nccgest-0.1.0/src/nccgest/mock_service/templates/services_list.html +39 -0
  26. nccgest-0.1.0/src/nccgest/types.py +61 -0
  27. nccgest-0.1.0/tests/mock_data/README.md +13 -0
  28. nccgest-0.1.0/tests/mock_data/services.yaml +48 -0
  29. nccgest-0.1.0/tests/test_client.py +69 -0
  30. nccgest-0.1.0/tests/test_mock_service.py +153 -0
@@ -0,0 +1,16 @@
1
+ .idea/
2
+ .venv/
3
+ __pycache__/
4
+ *.py[cod]
5
+ *.egg-info/
6
+ .pytest_cache/
7
+ .mypy_cache/
8
+ .ruff_cache/
9
+ .coverage
10
+ dist/
11
+ build/
12
+ htmlcov/
13
+ data/
14
+
15
+ # Local/internal materials not for public package
16
+ help/
nccgest-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Oleg Klishin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
nccgest-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,172 @@
1
+ Metadata-Version: 2.4
2
+ Name: nccgest
3
+ Version: 0.1.0
4
+ Summary: Sync and async Python client for NCCGEST REST API.
5
+ Project-URL: Homepage, https://github.com/klishinoleg/nccgest
6
+ Project-URL: Repository, https://github.com/klishinoleg/nccgest
7
+ Project-URL: Issues, https://github.com/klishinoleg/nccgest/issues
8
+ Author: Oleg Klishin
9
+ License: MIT
10
+ License-File: LICENSE
11
+ Keywords: api,booking,nccgest,rest,transport
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Programming Language :: Python :: 3.13
23
+ Classifier: Programming Language :: Python :: 3.14
24
+ Classifier: Typing :: Typed
25
+ Requires-Python: >=3.8
26
+ Requires-Dist: httpx<1,>=0.27
27
+ Provides-Extra: dev
28
+ Requires-Dist: build>=1.2.2; extra == 'dev'
29
+ Requires-Dist: fastapi<1,>=0.115; extra == 'dev'
30
+ Requires-Dist: itsdangerous<3,>=2.2; extra == 'dev'
31
+ Requires-Dist: jinja2<4,>=3.1; extra == 'dev'
32
+ Requires-Dist: mypy>=1.14.0; extra == 'dev'
33
+ Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
34
+ Requires-Dist: pytest>=8.3.0; extra == 'dev'
35
+ Requires-Dist: python-multipart>=0.0.9; extra == 'dev'
36
+ Requires-Dist: pyyaml<7,>=6.0; extra == 'dev'
37
+ Requires-Dist: ruff>=0.8.0; extra == 'dev'
38
+ Requires-Dist: twine>=6.0.0; extra == 'dev'
39
+ Requires-Dist: types-pyyaml>=6.0.12; extra == 'dev'
40
+ Requires-Dist: uvicorn<1,>=0.35; extra == 'dev'
41
+ Provides-Extra: mock
42
+ Requires-Dist: fastapi<1,>=0.115; extra == 'mock'
43
+ Requires-Dist: itsdangerous<3,>=2.2; extra == 'mock'
44
+ Requires-Dist: jinja2<4,>=3.1; extra == 'mock'
45
+ Requires-Dist: python-multipart>=0.0.9; extra == 'mock'
46
+ Requires-Dist: pyyaml<7,>=6.0; extra == 'mock'
47
+ Requires-Dist: uvicorn<1,>=0.35; extra == 'mock'
48
+ Description-Content-Type: text/markdown
49
+
50
+ # nccgest
51
+
52
+ [English](README.md) | [Italiano](README.it.md) | [Русский](README.ru.md)
53
+
54
+ Python package for synchronous and asynchronous interaction with the NCCGEST REST API.
55
+
56
+ Full method-by-method documentation:
57
+
58
+ - [docs/library_api.ru.md](C:/python/pip/nccgest/docs/library_api.ru.md) (RU)
59
+
60
+ ## Features
61
+
62
+ - Sync client: `NCCGestClient`
63
+ - Async client: `AsyncNCCGestClient`
64
+ - Command coverage:
65
+ - `cmd_read`
66
+ - `cmd_insert`
67
+ - `cmd_update`
68
+ - `cmd_customer`
69
+ - `cmd_driver`
70
+ - Typed API errors and HTTP errors
71
+ - Python `3.8+` support (recommended runtime: `3.10+`)
72
+
73
+ ## Installation
74
+
75
+ ```bash
76
+ pip install nccgest
77
+ ```
78
+
79
+ ## Quick Start (sync)
80
+
81
+ ```python
82
+ from nccgest import NCCGestClient
83
+
84
+ with NCCGestClient(domain="your-domain", token="YOUR_TOKEN") as client:
85
+ services = client.read_services(start_date="16/03/2026", end_date="16/03/2026")
86
+ print(services)
87
+ ```
88
+
89
+ ## Quick Start (async)
90
+
91
+ ```python
92
+ import asyncio
93
+ from nccgest import AsyncNCCGestClient
94
+
95
+ async def main() -> None:
96
+ async with AsyncNCCGestClient(domain="your-domain", token="YOUR_TOKEN") as client:
97
+ driver_data = await client.get_driver_data(driverid=123)
98
+ print(driver_data)
99
+
100
+ asyncio.run(main())
101
+ ```
102
+
103
+ ## Insert Service Example
104
+
105
+ ```python
106
+ from nccgest import NCCGestClient
107
+
108
+ payload = {
109
+ "pickup": "FCO",
110
+ "dropoff": "Roma",
111
+ "date": "16/03/2026",
112
+ "pickup_time": "10:30",
113
+ "pax": 2,
114
+ "paxname": "John Smith",
115
+ "paxphone": "+39000000000",
116
+ "servicetype": "Transfer",
117
+ "cartype": "Business Class",
118
+ "subclass": "EXT-ORDER-12345",
119
+ }
120
+
121
+ with NCCGestClient(domain="your-domain", token="YOUR_TOKEN") as client:
122
+ service_id = client.insert_service(payload)
123
+ print(service_id)
124
+ ```
125
+
126
+ ## API Notes
127
+
128
+ - Use HTTPS only.
129
+ - NCCGEST API docs mention no concurrent inserts: avoid parallel create calls.
130
+ - Use proper URL encoding for external inputs.
131
+ - Follow official endpoint method mapping (`GET` for read/customer/driver, `POST` for insert/update).
132
+
133
+ ## Development
134
+
135
+ ```bash
136
+ pip install -e ".[dev]"
137
+ pytest
138
+ ```
139
+
140
+ ## Mock Service (FastAPI + SQLite)
141
+
142
+ Install mock dependencies:
143
+
144
+ ```bash
145
+ pip install -e ".[mock]"
146
+ ```
147
+
148
+ Run:
149
+
150
+ ```bash
151
+ NCCGEST_LOGIN=test NCCGEST_PASSWORD=test NCCGEST_DBDIR=/data NCCGEST_PORT=8255 python -m nccgest.mock_service
152
+ ```
153
+
154
+ Alternative command:
155
+
156
+ ```bash
157
+ nccgest-mock
158
+ ```
159
+
160
+ Web UI:
161
+
162
+ - Login page: `http://localhost:8255/admin/login`
163
+ - Services admin: `http://localhost:8255/admin/services`
164
+ - Drivers admin: `http://localhost:8255/admin/drivers`
165
+ - API endpoint: `http://localhost:8255/api/rest_api.php`
166
+
167
+ The `/data` directory is ignored by git and used for the local SQLite DB.
168
+ Mock YAML fixtures for tests are stored in `tests/mock_data/services.yaml`.
169
+ UI templates and CSS are separated in:
170
+
171
+ - `src/nccgest/mock_service/templates/*.html`
172
+ - `src/nccgest/mock_service/static/style.css`
@@ -0,0 +1,87 @@
1
+ # nccgest
2
+
3
+ [English](README.md) | [Italiano](README.it.md) | [Русский](README.ru.md)
4
+
5
+ Pacchetto Python per integrare in modo sincrono e asincrono la REST API di NCCGEST.
6
+
7
+ ## Funzionalita
8
+
9
+ - Client sincrono: `NCCGestClient`
10
+ - Client asincrono: `AsyncNCCGestClient`
11
+ - Comandi supportati:
12
+ - `cmd_read`
13
+ - `cmd_insert`
14
+ - `cmd_update`
15
+ - `cmd_customer`
16
+ - `cmd_driver`
17
+ - Errori API e HTTP tipizzati
18
+ - Supporto Python `3.8+` (runtime consigliato: `3.10+`)
19
+
20
+ ## Installazione
21
+
22
+ ```bash
23
+ pip install nccgest
24
+ ```
25
+
26
+ ## Esempio rapido (sync)
27
+
28
+ ```python
29
+ from nccgest import NCCGestClient
30
+
31
+ with NCCGestClient(domain="your-domain", token="YOUR_TOKEN") as client:
32
+ services = client.read_services(start_date="16/03/2026", end_date="16/03/2026")
33
+ print(services)
34
+ ```
35
+
36
+ ## Esempio rapido (async)
37
+
38
+ ```python
39
+ import asyncio
40
+ from nccgest import AsyncNCCGestClient
41
+
42
+ async def main() -> None:
43
+ async with AsyncNCCGestClient(domain="your-domain", token="YOUR_TOKEN") as client:
44
+ driver_data = await client.get_driver_data(driverid=123)
45
+ print(driver_data)
46
+
47
+ asyncio.run(main())
48
+ ```
49
+
50
+ ## Note API
51
+
52
+ - Usare solo HTTPS.
53
+ - Evitare inserimenti concorrenti in parallelo.
54
+ - Codificare correttamente i parametri (URL encoding).
55
+ - Rispettare i metodi endpoint della documentazione (`GET` per read/customer/driver, `POST` per insert/update).
56
+
57
+ ## Servizio Mock (FastAPI + SQLite)
58
+
59
+ Installazione dipendenze:
60
+
61
+ ```bash
62
+ pip install -e ".[mock]"
63
+ ```
64
+
65
+ Avvio:
66
+
67
+ ```bash
68
+ NCCGEST_LOGIN=test NCCGEST_PASSWORD=test NCCGEST_DBDIR=/data NCCGEST_PORT=8255 python -m nccgest.mock_service
69
+ ```
70
+
71
+ Comando alternativo:
72
+
73
+ ```bash
74
+ nccgest-mock
75
+ ```
76
+
77
+ - Web UI (login/lista/modifica): `http://localhost:8255/admin/login`
78
+ - Servizi admin: `http://localhost:8255/admin/services`
79
+ - Driver admin: `http://localhost:8255/admin/drivers`
80
+ - API endpoint: `http://localhost:8255/api/rest_api.php`
81
+
82
+ La cartella `/data` e ignorata da git e contiene il DB SQLite locale.
83
+ I fixture YAML per i test sono in `tests/mock_data/services.yaml`.
84
+ Template e CSS separati:
85
+
86
+ - `src/nccgest/mock_service/templates/*.html`
87
+ - `src/nccgest/mock_service/static/style.css`
@@ -0,0 +1,123 @@
1
+ # nccgest
2
+
3
+ [English](README.md) | [Italiano](README.it.md) | [Русский](README.ru.md)
4
+
5
+ Python package for synchronous and asynchronous interaction with the NCCGEST REST API.
6
+
7
+ Full method-by-method documentation:
8
+
9
+ - [docs/library_api.ru.md](C:/python/pip/nccgest/docs/library_api.ru.md) (RU)
10
+
11
+ ## Features
12
+
13
+ - Sync client: `NCCGestClient`
14
+ - Async client: `AsyncNCCGestClient`
15
+ - Command coverage:
16
+ - `cmd_read`
17
+ - `cmd_insert`
18
+ - `cmd_update`
19
+ - `cmd_customer`
20
+ - `cmd_driver`
21
+ - Typed API errors and HTTP errors
22
+ - Python `3.8+` support (recommended runtime: `3.10+`)
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ pip install nccgest
28
+ ```
29
+
30
+ ## Quick Start (sync)
31
+
32
+ ```python
33
+ from nccgest import NCCGestClient
34
+
35
+ with NCCGestClient(domain="your-domain", token="YOUR_TOKEN") as client:
36
+ services = client.read_services(start_date="16/03/2026", end_date="16/03/2026")
37
+ print(services)
38
+ ```
39
+
40
+ ## Quick Start (async)
41
+
42
+ ```python
43
+ import asyncio
44
+ from nccgest import AsyncNCCGestClient
45
+
46
+ async def main() -> None:
47
+ async with AsyncNCCGestClient(domain="your-domain", token="YOUR_TOKEN") as client:
48
+ driver_data = await client.get_driver_data(driverid=123)
49
+ print(driver_data)
50
+
51
+ asyncio.run(main())
52
+ ```
53
+
54
+ ## Insert Service Example
55
+
56
+ ```python
57
+ from nccgest import NCCGestClient
58
+
59
+ payload = {
60
+ "pickup": "FCO",
61
+ "dropoff": "Roma",
62
+ "date": "16/03/2026",
63
+ "pickup_time": "10:30",
64
+ "pax": 2,
65
+ "paxname": "John Smith",
66
+ "paxphone": "+39000000000",
67
+ "servicetype": "Transfer",
68
+ "cartype": "Business Class",
69
+ "subclass": "EXT-ORDER-12345",
70
+ }
71
+
72
+ with NCCGestClient(domain="your-domain", token="YOUR_TOKEN") as client:
73
+ service_id = client.insert_service(payload)
74
+ print(service_id)
75
+ ```
76
+
77
+ ## API Notes
78
+
79
+ - Use HTTPS only.
80
+ - NCCGEST API docs mention no concurrent inserts: avoid parallel create calls.
81
+ - Use proper URL encoding for external inputs.
82
+ - Follow official endpoint method mapping (`GET` for read/customer/driver, `POST` for insert/update).
83
+
84
+ ## Development
85
+
86
+ ```bash
87
+ pip install -e ".[dev]"
88
+ pytest
89
+ ```
90
+
91
+ ## Mock Service (FastAPI + SQLite)
92
+
93
+ Install mock dependencies:
94
+
95
+ ```bash
96
+ pip install -e ".[mock]"
97
+ ```
98
+
99
+ Run:
100
+
101
+ ```bash
102
+ NCCGEST_LOGIN=test NCCGEST_PASSWORD=test NCCGEST_DBDIR=/data NCCGEST_PORT=8255 python -m nccgest.mock_service
103
+ ```
104
+
105
+ Alternative command:
106
+
107
+ ```bash
108
+ nccgest-mock
109
+ ```
110
+
111
+ Web UI:
112
+
113
+ - Login page: `http://localhost:8255/admin/login`
114
+ - Services admin: `http://localhost:8255/admin/services`
115
+ - Drivers admin: `http://localhost:8255/admin/drivers`
116
+ - API endpoint: `http://localhost:8255/api/rest_api.php`
117
+
118
+ The `/data` directory is ignored by git and used for the local SQLite DB.
119
+ Mock YAML fixtures for tests are stored in `tests/mock_data/services.yaml`.
120
+ UI templates and CSS are separated in:
121
+
122
+ - `src/nccgest/mock_service/templates/*.html`
123
+ - `src/nccgest/mock_service/static/style.css`
@@ -0,0 +1,91 @@
1
+ # nccgest
2
+
3
+ [English](README.md) | [Italiano](README.it.md) | [Русский](README.ru.md)
4
+
5
+ Python-библиотека для синхронной и асинхронной интеграции с REST API NCCGEST.
6
+
7
+ Полная инструкция по API библиотеки:
8
+
9
+ - [docs/library_api.ru.md](C:/python/pip/nccgest/docs/library_api.ru.md)
10
+
11
+ ## Возможности
12
+
13
+ - Синхронный клиент: `NCCGestClient`
14
+ - Асинхронный клиент: `AsyncNCCGestClient`
15
+ - Поддерживаемые команды:
16
+ - `cmd_read`
17
+ - `cmd_insert`
18
+ - `cmd_update`
19
+ - `cmd_customer`
20
+ - `cmd_driver`
21
+ - Типизированные ошибки API и HTTP
22
+ - Поддержка Python `3.8+` (рекомендуемый runtime: `3.10+`)
23
+
24
+ ## Установка
25
+
26
+ ```bash
27
+ pip install nccgest
28
+ ```
29
+
30
+ ## Быстрый старт (sync)
31
+
32
+ ```python
33
+ from nccgest import NCCGestClient
34
+
35
+ with NCCGestClient(domain="your-domain", token="YOUR_TOKEN") as client:
36
+ services = client.read_services(start_date="16/03/2026", end_date="16/03/2026")
37
+ print(services)
38
+ ```
39
+
40
+ ## Быстрый старт (async)
41
+
42
+ ```python
43
+ import asyncio
44
+ from nccgest import AsyncNCCGestClient
45
+
46
+ async def main() -> None:
47
+ async with AsyncNCCGestClient(domain="your-domain", token="YOUR_TOKEN") as client:
48
+ driver_data = await client.get_driver_data(driverid=123)
49
+ print(driver_data)
50
+
51
+ asyncio.run(main())
52
+ ```
53
+
54
+ ## Примечания по API
55
+
56
+ - Использовать только HTTPS.
57
+ - Не отправлять вставки услуг параллельно.
58
+ - Выполнять URL encoding входных параметров.
59
+ - Соблюдать методы endpoint-ов из документации (`GET` для read/customer/driver, `POST` для insert/update).
60
+
61
+ ## Mock-сервис (FastAPI + SQLite)
62
+
63
+ Установка зависимостей:
64
+
65
+ ```bash
66
+ pip install -e ".[mock]"
67
+ ```
68
+
69
+ Запуск:
70
+
71
+ ```bash
72
+ NCCGEST_LOGIN=test NCCGEST_PASSWORD=test NCCGEST_DBDIR=/data NCCGEST_PORT=8255 python -m nccgest.mock_service
73
+ ```
74
+
75
+ Или командой:
76
+
77
+ ```bash
78
+ nccgest-mock
79
+ ```
80
+
81
+ - Web UI (логин/списки/редактирование): `http://localhost:8255/admin/login`
82
+ - Услуги (админка): `http://localhost:8255/admin/services`
83
+ - Водители (админка): `http://localhost:8255/admin/drivers`
84
+ - API endpoint: `http://localhost:8255/api/rest_api.php`
85
+
86
+ Каталог `/data` исключен из git и используется для локальной SQLite базы.
87
+ Mock-фикстуры для автотестов лежат в `tests/mock_data/services.yaml`.
88
+ Шаблоны и стили вынесены отдельно:
89
+
90
+ - `src/nccgest/mock_service/templates/*.html`
91
+ - `src/nccgest/mock_service/static/style.css`