Metadata-Version: 2.4
Name: qls-mgw-cli
Version: 0.1.0
Summary: Command line sign-in and Python library for the API Gateway for Cisco Meraki (not affiliated with Cisco)
License-Expression: Apache-2.0
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
License-File: NOTICE
Requires-Dist: httpx>=0.27
Dynamic: license-file

# qls-mgw-cli

Command line sign-in and a small Python library for the API Gateway for Cisco Meraki.
Install it from PyPI as `qls-mgw-cli` (not `mgw`, which is an unrelated package). Your gateway
also serves the same wheel (the "My access" page shows the exact command).
It was called `mgw-cli` before: remove that first (`uv tool uninstall mgw-cli` or
`pip uninstall mgw-cli`). The command (`mgw`) and the import (`mgw_cli`) are unchanged.
The version is always the same as the gateway's version.

## Command line

    uv tool install qls-mgw-cli
    mgw login --gateway https://<gateway>
    mgw run -- python my_script.py

## Python

Install it into your project's environment, next to the `meraki` SDK:

    pip install meraki qls-mgw-cli

```python
from mgw_cli import Gateway

gw = Gateway("https://<gateway>")            # uses `mgw login` or MGW_TOKEN
# gw = Gateway.login("https://<gateway>")    # or sign in from Python (browser, MFA)

dashboard = gw.dashboard()                   # meraki.DashboardAPI through the gateway
print(dashboard.organizations.getOrganizations())

with gw.change("CHG-1234"):                  # change reference for these writes
    dashboard.networks.updateNetwork(network_id, name="Store 12")

with gw.temporary_dashboard(hours=8) as dashboard:   # long job: temporary API key, revoked afterwards
    ...

# Automation without a person (service account, client credentials):
gw = Gateway.from_client_credentials("https://<gateway>", client_id, client_secret)
```

Other calls: `whoami()`, `organizations()`, `create_api_key()`, `api_keys()`,
`revoke_api_key()`, `revoke_all_api_keys()`, `set_change_reference()`,
`clear_change_reference()`, `check_change_reference()`, and `call()` for any gateway
endpoint. Errors raise `GatewayError` with `.status`.

Not affiliated with, endorsed by or sponsored by Cisco Systems, Inc.
