Files
vmware-api-simulator/docs/ru/examples/python-requests.md
T
inecs f8d3cbdd59 Initial commit: VMware vSphere API simulator scaffold.
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.
2026-07-18 04:42:11 +03:00

34 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
**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 только для локального самоподписанного сертификата
разработческого шлюза.