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

File metadata

File hashes

Hashes for ppauth-0.1.7-cp313-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 569495197a63f26afe06e4ec898bcd36810dbee67dcc95e496eea076ff852afe
MD5 350d500f4e9dbc00c2d891f234b98c1a
BLAKE2b-256 7588c5e8475e857a2c959b046ce925168622d2f3ad0c8ce73b038e83ab744f27

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.7-cp312-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 05c40d4771b8a3431f4b5a8c1aee9d2504394490b23cea226bfc3c695ce6c0e3
MD5 c3bdb13ad4b04893251eea12d09b4f20
BLAKE2b-256 21c250d6a1d2b9cdc5556d4601d9e30330b5b3c66b161d39dd34d93fe86bbf9b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.7-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 0c41b32612c29d8827453df40385d65a9af698ce484158212f08f786ecdd6db1
MD5 1d034d7c40571fc0d332b143df671152
BLAKE2b-256 9b114c47347fc0c289cb866d295df53e8173fd5b4d645cd352f02e08e40fc0d2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.7-cp310-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 9fbf334b8884a31833ccc5cb3c0484b47c60c29dd2641d5a743869ca4daec824
MD5 d09de193a01244647d79c3a06d90a8df
BLAKE2b-256 a6af789ebdc4e4ed33371168333c0201d1b606193241267446ac81e673ff3150

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.7-cp39-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 cecc091e79584662713935c4c108bec2ce4e53ce9c53adcc1703f5391c8e0bf5
MD5 e48b9561323cc9170ccfbda3a798b22b
BLAKE2b-256 ed2921014e4c308eaf542bde70b49f7a158055ea8e324abb5e0c128ea1790599

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.7-cp38-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 3b87944d85d7f29fe24426516bdc64f2798c376fda6ae42c3639b7b793591d45
MD5 68af5f4e1a1cf39f69e6d11ef85ab417
BLAKE2b-256 1c91abc577afc1357fde98901579f3f8501c1f85b512dfa551ac1029dc8e735e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.7-cp37-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 64fe050489d23ab4c50de9b631d51e4ba17d13dab4cdccb2ddef781a327ea62f
MD5 32cf4548e6b89591c958ed221f5f708c
BLAKE2b-256 ac65b3907f32a9faf21ce16aa836ac6d135f38bdf7f7e48b85298d1fdeb2a69c

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