# Connection

Manages authenticated connections to the Fiddler platform.

The Connection class handles all aspects of connecting to and communicating with the Fiddler platform, including authentication, HTTP client management, server version compatibility checking, and organization context management.

This class provides the foundation for all API interactions with Fiddler, managing connection parameters, authentication tokens, and ensuring proper communication protocols are established.

## Examples

Creating a basic connection:

```python
connection = Connection(
    url="https://your-fiddler-instance.com",
    token="your-auth-token"
)
```

Creating a connection with custom timeout and proxy:

```python
connection = Connection(
    url="https://your-fiddler-instance.com",
    token="your-auth-token",
    timeout=(5.0, 30.0),  # (connect_timeout, read_timeout)
    proxies={"https": "https://proxy.company.com:8080"}
)
```

Creating a connection without SSL verification:

```python
connection = Connection(
    url="https://your-fiddler-instance.com",
    token="your-auth-token",
    verify=False,  # Not recommended for production
    validate=False  # Skip version compatibility check
)
```

Initialize a connection to the Fiddler platform.

## Parameters

| Parameter  | Type    | Required                       | Default | Description                                             |
| ---------- | ------- | ------------------------------ | ------- | ------------------------------------------------------- |
| `url`      | `str`   | ✗                              | `None`  | The base `URL` to your Fiddler platform instance        |
| `token`    | `str`   | ✗                              | `None`  | Authentication token obtained from the Fiddler UI       |
| `proxies`  | \`dict  | None\`                         | ✗       | `None`                                                  |
| `timeout`  | \`float | tuple\[float, float] \| None\` | ✗       | `None`                                                  |
| `verify`   | `bool`  | ✗                              | `True`  | Whether to verify server's `TLS` certificate            |
| `validate` | `bool`  | ✗                              | `True`  | Whether to validate server/client version compatibility |

## Raises

* **ValueError** -- If url or token parameters are empty
* **IncompatibleClient** -- If server version is incompatible with client version **Return type:** None

## *property* client *: RequestClient*

Get the HTTP request client instance for API communication.

## Returns

Configured HTTP client with authentication headers, proxy settings, and timeout configurations.

**Return type:** RequestClient

## *property* server\_info *: ServerInfo*

Get server information and metadata from the Fiddler platform.

## Returns

Server information including version, organization details, and platform configuration.

**Return type:** ServerInfo

## *property* server\_version *: Version*

Get the semantic version of the connected Fiddler server.

## Returns

Semantic version object representing the server version.

**Return type:** Version

## *property* organization\_name *: str*

Get the name of the connected organization.

## Returns

Name of the organization associated with this connection.

**Return type:** str

## *property* organization\_id *: UUID*

Get the UUID of the connected organization.

## Returns

Unique identifier of the organization associated with this connection.

**Return type:** UUID
