**Language / Язык:** [English](python-requests.md) | [Русский](../ru/examples/python-requests.md)

# Python — REST (requests / stdlib)

Raw HTTP against the vSphere REST gateway, no vendor SDK required.

```bash
pip install -r examples/python/requirements.txt
python examples/python/requests_cookbook.py
```

[`requests_cookbook.py`](../../examples/python/requests_cookbook.py)
demonstrates the shared session → create → wait-for-task → power on → wait →
power off → delete flow using `requests`, with the session id carried as the
`vmware-api-session-id` header.

For a dependency-free variant using only the standard library (`urllib`),
see [`vsphere_rest_smoke.py`](../../examples/python/vsphere_rest_smoke.py):

```bash
python examples/python/vsphere_rest_smoke.py https://localhost
```

For a combined REST-create + SOAP-`CreateVM_Task` + guest-filesystem smoke,
see [`vsphere_lifecycle.py`](../../examples/python/vsphere_lifecycle.py):

```bash
VSPHERE_BASE=https://localhost python examples/python/vsphere_lifecycle.py
```

All three scripts default to `administrator@vsphere.local` / `VMware1!` and
disable TLS verification for the local self-signed development gateway
certificate only.
