Skip to main content

npm-client

PyPI Version

Python client for Nginx Proxy Manager

Installation

pip install npm-client

Examples

Create class

from npm_client import NginxClient
npmClient = NginxClient( "NGINX_PROXY_MANAGER_DOMAIN", "NGINX_PROXY_MANAGER_USER", "NGINX_PROXY_MANAGER_PASSWORD" )

where:

  • NGINX_PROXY_MANAGER_DOMAIN: URL of Nginx Proxy Manager WebUi page
  • NGINX_PROXY_MANAGER_USER: Token of Nginx Proxy Manager WebUi
  • NGINX_PROXY_MANAGER_PASSWORD: Password of Nginx Proxy Manager WebUi

or using environment variables "NGINX_PROXY_MANAGER_DOMAIN" and "NGINX_PROXY_MANAGER_USER" and "NGINX_PROXY_MANAGER_PASSWORD":

from dotenv import load_dotenv
import os
from npm_client import NginxClient
load_dotenv()

def main():
    npmClient = NginxClient( 
        base_url=os.getenv('NGINX_PROXY_MANAGER_DOMAIN'), 
        login=os.getenv('NGINX_PROXY_MANAGER_USER'),
        password=os.getenv('NGINX_PROXY_MANAGER_PASSWORD')
    )

    print( npmClient.get_proxy_host_by_id(1) )
if __name__ == "__main__":
    main() 

Methods

# Get a list of certificates
npmClient.get_certificates()
# Get certificate by name
npmClient.get_certificate_by_name(certificate_name="home.homelab.lan")
# Get proxy hosts list
npmClient.get_proxy_hosts()
# Get proxy host by one of the domains
npmClient.get_proxy_host_by_domian(domain="home.homelab.lan")
# Get proxy host by its id
npmClient.get_proxy_host_by_id(id=1)
# Create new proxy host
npmClient.create_proxy_host(
    domain_names=["router.homelab.lan", "router2.homelab.lan"],
    forward_scheme="http",
    forward_host="192.168.1.1",
    forward_port="8080",
    caching_enabled=True,
    allow_websocket_upgrade=True,
    ssl_forced=True,
    certificate_id=1,
)
# Delete proxy host
npmClient.delete_proxy_host(id=1)

Release files for npm-client 1.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for npm-client 1.0.3
File Size Uploaded
npm_client-1.0.3.tar.gz 4.3 kB Details

Release files / npm_client-1.0.3.tar.gz

Download URL npm_client-1.0.3.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7ce45498f12132ecb45d6789eb168e82c80486b89f2da53c110919ce477fdab1
BLAKE2b-256 checksum
How to use checksums
5dd97fdb0b3fcc225af81184e7d77a72b19345e4170686576963a1ed6fd2e1f0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.4

Release history Release notifications | RSS feed

This release

1.0.3 This release

1 release file

1.0.2

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page