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.8-cp313-abi3-manylinux_2_34_x86_64.whl (5.4 MB view details)

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

ppauth-0.1.8-cp312-abi3-manylinux_2_34_x86_64.whl (5.4 MB view details)

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

ppauth-0.1.8-cp311-abi3-manylinux_2_34_x86_64.whl (5.4 MB view details)

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

ppauth-0.1.8-cp310-abi3-manylinux_2_34_x86_64.whl (5.4 MB view details)

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

ppauth-0.1.8-cp39-abi3-manylinux_2_34_x86_64.whl (5.4 MB view details)

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

ppauth-0.1.8-cp38-abi3-manylinux_2_34_x86_64.whl (5.4 MB view details)

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

ppauth-0.1.8-cp37-abi3-manylinux_2_34_x86_64.whl (5.4 MB view details)

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

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.8-cp313-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 64f61a1ad8c8fcb09ad5e7d2ef4a2f921a1735ba3f30cbc8ae01ef43ca905656
MD5 5e2cd3455696ddcbf928c0fbe89fa611
BLAKE2b-256 1f4cf9089856e64b2ecaa0c9e5ca3cc3cce6bc87810d534ec387fbda0b5e3965

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.8-cp312-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 3481fe41ab4a7cfbae43bc4e729b33bc274411423a62849fc14192fa82ae38bd
MD5 829a8e076430fdfadc7ed79525bd8a49
BLAKE2b-256 0cd9690c070c152550df3380360538de130c0ad4c8700e891fd39096ee593d17

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.8-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 9bee551eb02ffce8bacbd0ae1dbc3a8ec597bec797b7d5b00a7e22efe0ffdab3
MD5 5d9ef106c5e3db411329939758181c16
BLAKE2b-256 7dbc4449dc167e1daf840cf4e1462031dcc2c66e6f320acabe661059550c1412

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.8-cp310-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ea7e9c060c47bbfa73e6f2026d11322021ee72c91154c30f7276ed6e2e137ac8
MD5 2cb692db231d6eb9910eec0207805eab
BLAKE2b-256 61f47a397b4df052ab1091b66beef9e043651b57548d577e209da063623f689a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.8-cp39-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 27fb819fbdbf88362222e00f690ddc41c761d121ca8509734e4f71bf9379c8bf
MD5 0bcb4e034777d0249141f0bf6eacfdea
BLAKE2b-256 17f06d537763fed4bc1965a0dd85489193b7188585d0c1d0e69daf9e5c0219b4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.8-cp38-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b3ae3c080a03cb77155e8ffddda41b13d387d1c3aabb6952c2c3d53cd4b8ef3d
MD5 5f8f572054c6a548688d00c61b12b7f4
BLAKE2b-256 82ea084fc49affa98f68add5834733f756b40aa0dbe503a3465af4f245f854f9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.8-cp37-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b6b026fdf465ad4b07943599b6e95c702b9455c4e1cbefbcc9eadc05b6b914c2
MD5 e2c0ccb5fcbc23dfb94208152d9214f9
BLAKE2b-256 798624e42e3c065db0ba988292c5c3e7fdcafb540801cc6337daac60d8da6ee5

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