# ovok_sdk.http.client

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

The authenticated JSON client every namespace sends through.

## HttpContext [#httpcontext]

```python
HttpContext(settings: OvokSettings, credentials: Credentials, retry_policy: RetryPolicy)
```

What every `HttpClient` shares.

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `settings` | `OvokSettings` | The client's settings. |
| `credentials` | `Credentials` | Supplies the bearer token. |
| `retry_policy` | `RetryPolicy` | Decides when to retry. |

## HttpClient [#httpclient]

```python
HttpClient(context: HttpContext, base_path: str = '')
```

JSON over the Ovok API: bearer auth, one refresh after a 401, and retries for safe requests.

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `context` | `HttpContext` |  | Settings, credentials and retry policy. |
| `base_path` | `str` | `''` | Path every request is relative to. |

### under() [#under]

```python
under(path: str) -> HttpClient
```

Return a client whose requests are relative to `path` under this one.

### anonymous() [#anonymous]

```python
anonymous() -> HttpClient
```

Return a client that sends no credentials.

### get() [#get]

```python
get(path: str) -> Any
```

Send a GET; see `send`.

### post() [#post]

```python
post(path: str, body: Any = None) -> Any
```

Send a POST with an optional JSON body; see `send`.

### put() [#put]

```python
put(path: str, body: Any) -> Any
```

Send a PUT with a JSON body; see `send`.

### patch() [#patch]

```python
patch(path: str, body: Any) -> Any
```

Send a PATCH with a JSON body; see `send`.

### delete() [#delete]

```python
delete(path: str) -> Any
```

Send a DELETE; see `send`.

### send() [#send]

```python
send(request: HttpRequest) -> Any
```

Send `request` with auth, retries and one refresh after a 401.

**Returns**

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

**Raises**

- `OvokError`: The subclass for the response status, or `OvokConnectionError`.
