f8d3cbdd59
Add the FastAPI app, PostgreSQL migrations, Docker/Helm packaging, API contracts, docs, client examples, and the unit/integration/compatibility test suite for local client and tooling labs without a real vCenter.
34 lines
1.5 KiB
Markdown
34 lines
1.5 KiB
Markdown
**Language / Язык:** [English](../../examples/python-requests.md) | [Русский](python-requests.md)
|
||
|
||
# Python — REST (requests / stdlib)
|
||
|
||
Сырой HTTP к REST-шлюзу vSphere без vendor SDK.
|
||
|
||
```bash
|
||
pip install -r examples/python/requirements.txt
|
||
python examples/python/requests_cookbook.py
|
||
```
|
||
|
||
[`requests_cookbook.py`](../../../examples/python/requests_cookbook.py)
|
||
демонстрирует общий поток session → create → wait-for-task → power on → wait →
|
||
power off → delete с помощью `requests`; идентификатор сессии передаётся в
|
||
заголовке `vmware-api-session-id`.
|
||
|
||
Для варианта без внешних зависимостей, только на стандартной библиотеке
|
||
(`urllib`), см. [`vsphere_rest_smoke.py`](../../../examples/python/vsphere_rest_smoke.py):
|
||
|
||
```bash
|
||
python examples/python/vsphere_rest_smoke.py https://localhost
|
||
```
|
||
|
||
Для комбинированного smoke REST-create + SOAP-`CreateVM_Task` + guest-filesystem
|
||
см. [`vsphere_lifecycle.py`](../../../examples/python/vsphere_lifecycle.py):
|
||
|
||
```bash
|
||
VSPHERE_BASE=https://localhost python examples/python/vsphere_lifecycle.py
|
||
```
|
||
|
||
Все три скрипта по умолчанию используют `administrator@vsphere.local` / `VMware1!`
|
||
и отключают проверку TLS только для локального самоподписанного сертификата
|
||
разработческого шлюза.
|