Skip to main content

Python bindings for ProxyAuth authentication via Rust

Project description

PyProxyAuth



A lightweight Python library to authenticate and retrieve tokens via ProxyAuth.

install

pip install ppauth

usage

import ppauth

ppauth.auth(
    host="127.0.0.1", port=8080,
    username="admin", password="admin123",
    
    # Optional TOTP code (used if two-factor authentication is enabled).
    # Note: If using TOTP, the server should issue a token with a minimum 1-day expiration.
    # As a developer, you should provide a new TOTP code each time the token expires.
    totp="56845",
    
    timezone="Europe/Paris" 
)

token = ppauth.token()
token = ppauth.token(renew=True) # Automatically re-authenticates and returns a new token if the previous one has expired.
lease_token = ppauth.lease_token()

print({"token": token, "expire_at": lease_token})

# result
# {"expire_at": 16500,"token":"ZoHAauGmCyxjq6+1sfVbqy..."}

# for easy use method GET
# Use the route defined in routes.yml within your backend delivery. 
# You don't need to manually include the token in the headers it's handled automatically
headers = {"user-agent": "ppauth/0.1.1"}
params = {"params_key": "my_send_request_params_via_get"}

ppauth.get(
    "/app",          # The API route (relative path) to call on the authenticated backend
    headers=headers, # Optional custom HTTP headers (Python dict), e.g. {"X-User": "admin"}
    params=params,   # Optional query parameters (Python dict), e.g. {"limit": "10"}
    verify=False,    # Disable TLS certificate verification (useful for self-signed certs)
    timeout=5,       # Max duration (in seconds) to wait for a response before failing
    retry=5          # Number of retry attempts if the request fails (timeout or server error)
)

# result
# 'ok'

# you are similar for POST method
headers = {"user-agent": "ppauth/0.1.1"}
body = {"body_key": "my_send_request_data_via_post"}
json = {"json_key": "my_send_request_json_data_via_post"}

ppauth.post(
    "/app",          # The API route (relative path) to call on the authenticated backend
    headers=headers, # Optional custom HTTP headers (Python dict), e.g. {"Content-Type": "application/json"}
    body=body,       # (If implemented) Optional raw body content (usually a string or bytes)
    json=json,       # Optional JSON body (Python dict) that will be serialized and sent as application/json
    timeout=5,       # Max duration (in seconds) to wait for a response before raising a timeout error
    verify=False,    # Disable TLS certificate verification (useful for self-signed certificates)
    retry=2          # Number of retry attempts if the request fails (e.g., timeout or 5xx server errors)
)

# result
# 'ok'

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

ppauth-0.1.10-cp313-abi3-manylinux_2_34_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.13+manylinux: glibc 2.34+ x86-64

ppauth-0.1.10-cp312-abi3-manylinux_2_34_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.34+ x86-64

ppauth-0.1.10-cp311-abi3-manylinux_2_34_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.11+manylinux: glibc 2.34+ x86-64

ppauth-0.1.10-cp310-abi3-manylinux_2_34_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.34+ x86-64

ppauth-0.1.10-cp39-abi3-manylinux_2_34_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.34+ x86-64

ppauth-0.1.10-cp38-abi3-manylinux_2_34_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.8+manylinux: glibc 2.34+ x86-64

ppauth-0.1.10-cp37-abi3-manylinux_2_34_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.7+manylinux: glibc 2.34+ x86-64

File details

Details for the file ppauth-0.1.10-cp313-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ppauth-0.1.10-cp313-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 6fec1e8c4c3632d6781f6dcedb6e5342454980586416522035ae0cbc45913d02
MD5 ae6eb47a0564152bc3bed00b07da5161
BLAKE2b-256 e9a8359920abdd7e2cf9732000d0e53e3470779c61241bd38c3a9173f44ccecd

See more details on using hashes here.

File details

Details for the file ppauth-0.1.10-cp312-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ppauth-0.1.10-cp312-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4be756766856a79cf64ce2334690368f7117b54ec7dcc8121823455944b55606
MD5 6d3b1cf030c2a4701fc829d9f020dea9
BLAKE2b-256 daa978ed94107e00266c1f973f4095f4bb88d3ea1f736a1616b8ffab877f380a

See more details on using hashes here.

File details

Details for the file ppauth-0.1.10-cp311-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ppauth-0.1.10-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 5b9187b727e96c37ca4edd1b509e6976d49dcd9322eef8e3c62274125186ac91
MD5 0ee6be04c8bcda7cbca8241eca8f92c8
BLAKE2b-256 5d8f6429f9d6fcff3272d71d299fd79af12c8daba4d8cd2fca23e58583b1758a

See more details on using hashes here.

File details

Details for the file ppauth-0.1.10-cp310-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ppauth-0.1.10-cp310-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4b479e1658bf1efb77d3dd01c18730d32bc4cc175dc4fbaa621dcf9d0cc5978e
MD5 603ada72b02be4291a955048b16af37a
BLAKE2b-256 b087a8fc11346fa603dca24e23ae40986e3c3a27ef98df6f6ae0c62251286631

See more details on using hashes here.

File details

Details for the file ppauth-0.1.10-cp39-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ppauth-0.1.10-cp39-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 88cf4a52e0b320b75be073e75126f2e9bfac62c3d8cb0a9910b8aebf6eb17c86
MD5 9d3278800bca65c822244e347c8ba825
BLAKE2b-256 027a4d1966cfe138967150c345bdc3af3d521dd8d438465404c641be3d2be232

See more details on using hashes here.

File details

Details for the file ppauth-0.1.10-cp38-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ppauth-0.1.10-cp38-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 3e797baef0fb4011b33c9c6b287b881d8da0c3d1f6eeac36ab9a90476e551943
MD5 dc3be15b92923a4030f26cbab8725b8f
BLAKE2b-256 adcc52a97effa68f0e772c04164b74a059aeba36cd7828a2f28ec845548e749a

See more details on using hashes here.

File details

Details for the file ppauth-0.1.10-cp37-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ppauth-0.1.10-cp37-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 115f490c827408f721b07748094783a68efc78256deb8db546fa5e7669ebca34
MD5 c706d1264898f47bfc56a6c8ee4ef31b
BLAKE2b-256 b17c86fb22a25daa0771a91600ca2d4e4450e460ccf584828a65385b3eb1e892

See more details on using hashes here.

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