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",
    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.5-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.5-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.5-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.5-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.5-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.5-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.5-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.5-cp313-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for ppauth-0.1.5-cp313-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 3da9293732b11bb2879511f188c86c8f8680d53d782e2cba47aac89853d5e1e7
MD5 8a6775308b43766d1c14a40a8fd45a9d
BLAKE2b-256 5c96dc33b9c9c206c5d46bfe4993a1c1e403a541d2423b06748f19749b9ed636

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.5-cp312-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 27032b1d9c48707632ffd47e7e6a373060b3e10ede1bd76b77230d071d279241
MD5 4abdeb4465ff172e476be8d165102a71
BLAKE2b-256 30fc45632907f0decc97ffc368f31a6c697c9eb55897f010912284746e0ab298

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.5-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b8fa8437decdf603987f5d2133fc246603018f4d014bd38e04798f5dc9e4e9a9
MD5 c26e3e90b7a5a0558b99a5ac43e15c9b
BLAKE2b-256 33313dc5cdbf091bc279777665700f3c2373bc2433bd6e5e38a6c7b10a27be0c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.5-cp310-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ad365d71a470106466648baea9afa1bf4c0094491727345cd894a98039081742
MD5 b8d259843d7e4ec88e78f5edae035c63
BLAKE2b-256 663144e27a8432c47946ce9044016489cb179afb3300b37e354cf2ddc7e02d56

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.5-cp39-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 25977223ac651146a9def2ba0fc6777b6ed727712649b48736143b35fc17b247
MD5 b724857cef02c8b2143af2f5fe986cad
BLAKE2b-256 6c4be68a2cdd53f7c4deb92684fe228821d7a31e2c35cdf34b0c636e5ed917a1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.5-cp38-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1433a3e1767d62c9cd21810a88d61ef733154f14e8a473b5948ca5ec9d145a46
MD5 63f2d4932a50b5ba1c41c4946c4f8db1
BLAKE2b-256 54b6997863bc5a4ac403f8f231037e5cb961e9ea63608ed0e2e9a79188e30aae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.5-cp37-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 196da6f44bc7a4b41e238cb1431e5ea5f3bfe1c1600fd905b9f0b4c15251e473
MD5 46a2522b0d9a0656ecb72a81a65ac736
BLAKE2b-256 fbe719beb58417ca3bdc708f59dba42f688878942c96075399ed6758bfc1f10b

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