Metadata-Version: 2.5
Name: UGOS
Version: 1.0.1
Summary: Python client for the UserGate NGFW web-console API
Project-URL: Repository, https://codeberg.org/owldog/ugos
License-Expression: MIT-0
License-File: LICENSE
Keywords: api,firewall,httpx,ngfw,ugos,usergate
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: System :: Networking :: Firewalls
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: httpx<0.29,>=0.27
Description-Content-Type: text/markdown

# UGOS

Synchronous Python client for the UserGate NGFW web-console API.

- Python 3.10+
- `httpx` transport
- compatible with UserGate NGFW 7.x
- typed resources plus exact access to every catalog action

## Install

```bash
uv add UGOS
```

From a local wheel:

```bash
uv add ./dist/ugos-*.whl
```

## Quick start

### Environment variables

```bash
export UGOS_URL=https://ngfw.example:8001
export UGOS_USERNAME=Admin
export UGOS_PASSWORD=...
export UGOS_VERIFY=true
export UGOS_TIMEOUT=30
```

```python
from ugos import UGOSClient

with UGOSClient.from_env() as client:
    client.login()

    print(client.licensing.get_info())
    print(client.users.list(limit=20).total)

    for user in client.users.iter_all(page_size=100):
        print(user["name"])
```

`from_env()` reads:

| Parameter | Environment variable | Default |
|---|---|---|
| `base_url` | `UGOS_URL` | required |
| `username` | `UGOS_USERNAME` | `None` |
| `password` | `UGOS_PASSWORD` | `None` |
| `verify` | `UGOS_CA_BUNDLE`, `UGOS_VERIFY` | `True` |
| `timeout` | `UGOS_TIMEOUT` | `30.0` |
| `allow_insecure_http` | `UGOS_ALLOW_INSECURE_HTTP` | `False` |

`UGOS_CA_BUNDLE` takes precedence over `UGOS_VERIFY` and accepts a path to a
CA bundle. `UGOS_VERIFY` accepts `true`, `false`, `1`, `0`, `yes`, `no`,
`on`, `off`, or a CA path.

### Explicit configuration

```python
with UGOSClient(
    base_url="https://ngfw.example:8001",
    username="Admin",
    password="...",
    verify="/path/to/ca.pem",
    timeout=30,
) as client:
    client.login()
    print(client.users.list(limit=20).total)
```

`from_env()` also accepts keyword overrides, which take precedence over
environment variables:

```python
with UGOSClient.from_env(password="...", verify=False) as client:
    client.login()
```

## Generic and typed access

```python
client.users.list(limit=50)                 # typed helper
client.users.actions.UsersList(limit=50)    # exact action
client.call("users", "UsersList", limit=50) # raw call
client.dhcp.list()                          # generic resource
```

## Proxy ARP

Proxy ARP is controlled through interface `link_info` parameters:

```python
client.interfaces.set_proxy_arp("port0:node", enabled=True)
client.interfaces.get_link_info("port0:node")

client.interfaces.set_link_info(
    "port0:node",
    {"proxy_arp": 1, "proxy_arp_pvlan": 0},
)
```

`set_link_info()` merges existing parameters by default.

## Errors

```python
from ugos import NotFoundError, UGOSError

try:
    client.users.get(999)
except NotFoundError as exc:
    print(exc.code, exc.message)
except UGOSError as exc:
    print(exc)
```

## Compatibility

Compatible with UserGate NGFW 7.x. For builds with a different action set, pass
`catalog_check=False` or `strict=False`.

## License

MIT-0. See `LICENSE`.
