Metadata-Version: 2.4
Name: uictlapi
Version: 0.1.1
Summary: Curl-like CLI for the UniFi Controller / UniFi OS Web UI API, with login and CSRF handled for you.
Author-email: Roman Akinfeev <akinfold@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/akinfold/uictlapi
Project-URL: Repository, https://github.com/akinfold/uictlapi
Project-URL: Issues, https://github.com/akinfold/uictlapi/issues
Keywords: unifi,ubiquiti,api,cli,networking,controller,docker
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Internet
Classifier: Topic :: System :: Networking
Classifier: Topic :: Utilities
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.0.0
Requires-Dist: requests>=2.25.0
Requires-Dist: requests-unifi-auth>=0.1.5
Provides-Extra: test
Requires-Dist: pytest>=7.0.0; extra == "test"
Requires-Dist: pytest-cov>=4.0.0; extra == "test"
Requires-Dist: ruff>=0.8.0; extra == "test"
Dynamic: license-file

# uictlapi

[![PYPI](https://img.shields.io/pypi/v/uictlapi)](https://pypi.org/project/uictlapi/)
[![Docker Image](https://img.shields.io/docker/v/akinfold/uictlapi?label=docker&sort=semver)](https://hub.docker.com/r/akinfold/uictlapi)
[![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/akinfold/uictlapi/blob/main/LICENSE)

Curl-like CLI for the UniFi Controller / UniFi OS Web UI API — with login and CSRF
handled for you.

Auth and CSRF come from
[`requests-unifi-auth`](https://github.com/akinfold/requests-unifi-auth). This package is
only the HTTP CLI: any Web UI / proxy URL, any method. It is **not** a typed UniFi SDK and
does not invent domain commands (`routes apply`, inventory, multi-controller orchestration).

Live auth/CSRF compatibility against real controllers is tracked in
[`requests-unifi-auth` COMPATIBILITY.md](https://github.com/akinfold/requests-unifi-auth/blob/main/COMPATIBILITY.md).

## Installation

### pip

```bash
pip install uictlapi
```

Requires `requests-unifi-auth>=0.1.5`.

### Docker

```bash
docker run --rm akinfold/uictlapi:latest --help
```

## Usage

Auth string: `user:pass@host` (or `@/path/to/file` containing the same).

```bash
# Read traffic routes (policy-based routing)
uictlapi get -a 'user:pass@192.168.1.1' --no-verify \
  'https://192.168.1.1/proxy/network/v2/api/site/default/trafficroutes'

# Same via Docker
docker run --rm akinfold/uictlapi:latest get -a 'user:pass@192.168.1.1' --no-verify \
  'https://192.168.1.1/proxy/network/v2/api/site/default/trafficroutes'

# POST JSON body (from string or @file)
uictlapi post -a 'user:pass@192.168.1.1' --no-verify \
  -j '{"enabled":true}' \
  'https://192.168.1.1/proxy/network/v2/api/site/default/some-endpoint'

uictlapi --version
```

Common flags mirror curl-ish habits: `-H` / `-p` / `-d` / `-j` / `-o` / `--show-headers` /
`--status-only` / `--no-verify` / `-t`. Exit status `1` on HTTP ≥ 400, `2` on transport errors.

## Releasing

Version lives in `pyproject.toml` and `src/uictlapi/__init__.py`. Bump on `main` first
(GitHub Actions → **Bump version**, or locally with `bump-my-version`), then:

```bash
git tag vX.Y.Z
git push origin vX.Y.Z
```

The **Publish** workflow runs tests, uploads to PyPI, pushes multi-arch Docker images
(`X.Y.Z`, `X.Y`, and `latest` when appropriate), and creates a GitHub Release.

## License

MIT
