Skip to main content

Modern Python SDK for the Nginx Proxy Manager API.

Project description

nginx-proxy-manager-sdk

A modern Python SDK for the Nginx Proxy Manager API.

Features

  • Typed, Pythonic client interface with resource-oriented APIs
  • Automatic login when you pass email/password credentials
  • Defensive validation for domain names and advanced nginx config snippets
  • Pre-configured packaging, testing, linting, documentation, and CI/CD workflows
  • Friendly local workflows for uv, virtualenv, pytest, and pre-commit

Installation

pip install nginx-proxy-manager-sdk

For local development with uv:

uv venv
source .venv/bin/activate
uv pip install -e .[dev]
pre-commit install

Or with the standard library tooling:

python -m venv .venv
source .venv/bin/activate
python -m pip install -e .[dev]
pre-commit install

Quick start

from nginx_proxy_manager_sdk import NginxProxyManagerClient

with NginxProxyManagerClient(
    "http://127.0.0.1:81",
    email="admin@example.com",
    password="your-password",
) as client:
    hosts = client.proxy_hosts.list()

    host = client.proxy_hosts.create(
        domain_names=["app.example.com"],
        forward_scheme="http",
        forward_host="127.0.0.1",
        forward_port=3000,
        certificate_id="new",
        ssl_forced=True,
        allow_websocket_upgrade=True,
    )

Authentication

Managed credentials

When you pass email and password, the client automatically fetches a bearer token on the first authenticated request.

Pre-issued token

client = NginxProxyManagerClient(
    "http://127.0.0.1:81",
    token="eyJhbGciOi...",
)

Manual login and refresh

client = NginxProxyManagerClient(
    "http://127.0.0.1:81",
    email="admin@example.com",
    password="secret",
)
token_data = client.login()
refreshed = client.refresh_token()

Resource APIs

Proxy hosts

client.proxy_hosts.list(expand=["owner", "certificate"], query="example.com")
client.proxy_hosts.get(1)
client.proxy_hosts.update(1, forward_port=4000, ssl_forced=True)
client.proxy_hosts.enable(1)
client.proxy_hosts.disable(1)
client.proxy_hosts.delete(1)

Certificates

client.certificates.list()
client.certificates.get(1)
client.certificates.create(
    provider="letsencrypt",
    domain_names=["*.example.com"],
    meta={
        "dns_challenge": True,
        "dns_provider": "cloudflare",
        "dns_provider_credentials": "dns_cloudflare_api_token = xxxxx",
        "propagation_seconds": 30,
    },
)
client.certificates.renew(1)
client.certificates.test_http(["app.example.com"])
client.certificates.delete(1)

API documentation

The MkDocs site includes API reference pages generated from package docstrings.

mkdocs serve

Local development workflows

A Makefile is included for common tasks:

  • make install
  • make lint
  • make test
  • make docs
  • make build

Equivalent direct commands:

  • pytest for unit tests
  • black src tests for formatting
  • flake8 src tests for linting
  • pre-commit run --all-files to run repository hooks
  • python -m build to produce wheel and sdist artifacts

Publishing

Build artifacts locally:

python -m build

Upload manually if needed:

twine upload dist/*

GitHub Actions also includes a trusted-publishing workflow for PyPI releases triggered by GitHub Releases.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nginx_proxy_manager_sdk-0.1.0.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nginx_proxy_manager_sdk-0.1.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file nginx_proxy_manager_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: nginx_proxy_manager_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nginx_proxy_manager_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c1a833507f82f8b5af5e1f7b267fcb9d314f1282723e3c17fdea9ff735f7c74e
MD5 ea9c7ad045eda0fdcb79f4ddb8e624d3
BLAKE2b-256 dca0e8ed80726845c04c9dd5021a900858ce9def827b46663eeed8768e6cb378

See more details on using hashes here.

Provenance

The following attestation bundles were made for nginx_proxy_manager_sdk-0.1.0.tar.gz:

Publisher: publish.yml on jasongi/nginx-proxy-manager-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nginx_proxy_manager_sdk-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for nginx_proxy_manager_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7491e27ac5649da7810bbfa2ee5b6cc33e270f680c260b651749f46ad7062e97
MD5 916f860ce6869cb51db8f3d8437d3b60
BLAKE2b-256 ad09b298e4e77ca2ef6cc927c7ec3a7c53867c51629fee6e1d40cff4744eb3f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for nginx_proxy_manager_sdk-0.1.0-py3-none-any.whl:

Publisher: publish.yml on jasongi/nginx-proxy-manager-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page