# ovok_sdk.http.transport

Canonical page: https://docs.ovok.com/python-sdk/reference/http/transport

The pluggable transport that sends HTTP requests.

## OvokRequest [#ovokrequest]

```python
OvokRequest(
    method: str,
    url: str,
    headers: Mapping[str, str],
    body: str | None,
    timeout: float,
)
```

An HTTP request ready to send.

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `method` | `str` | HTTP method. |
| `url` | `str` | Absolute URL. |
| `headers` | `Mapping[str, str]` | Request headers; never shown in `repr`. |
| `body` | `str \| None` | Encoded body, or None. |
| `timeout` | `float` | Timeout in seconds. |

## OvokResponse [#ovokresponse]

```python
OvokResponse(status: int, headers: Mapping[str, str], body: str)
```

An HTTP response of any status.

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `status` | `int` | HTTP status. |
| `headers` | `Mapping[str, str]` | Response headers; never shown in `repr`. |
| `body` | `str` | Decoded body text. |

### is_success [#is_success]

```python
is_success: bool
```

Whether the status is 2xx.

### header() [#header]

```python
header(name: str) -> str | None
```

Return the header `name`, matched case-insensitively, or None.

### json() [#json]

```python
json() -> Any
```

Parse the body as JSON.

**Returns**

- `Any`: The parsed body, or None when it is empty.

**Raises**

- `OvokError`: The body is not JSON.

## Transport [#transport]

```python
Transport()
```

Bases: `Protocol`

Sends one request; answers every HTTP status, raising only when no answer came.

## UrllibTransport [#urllibtransport]

```python
UrllibTransport(open_url: OpenUrl = urlopen)
```

The default `Transport`, built on `urllib.request`.

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `open_url` | `OpenUrl` | `urlopen` | Opens a request; defaults to `urllib.request.urlopen`. |
