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

File metadata

File hashes

Hashes for ppauth-0.1.4-cp313-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b0fb60792bacf8bb719c53c7e87c0a46300022a5761f1427bc5a6be1403c2eba
MD5 b533833ce8d4a6269465e800bfcd59da
BLAKE2b-256 590e48ae82d7f9ad6700286c410af584af4afdd715aa09843fc6bee2f5775751

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.4-cp312-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 5e443028f43548a7ee28e8d81b8a77ce1e5e9823a3c009e7efa4ef3c5a2a0e1a
MD5 6f77cb8fcc6aee21c9131b57d92484f0
BLAKE2b-256 114fa0b67f2bd406e507120ab1e50558ed0e8199a39d66ef6a2fbeee060b15a0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.4-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 0e22d4b3fe4af7ceeba9056351e3b5614430301ccea64ec8c29f3ed1cae50832
MD5 332c1d7c79ac96c845520b5ccea5f075
BLAKE2b-256 7d85e5b4c9978dad08ce915b487383a497c61c9c768b16c097a7d3033a05dab6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.4-cp310-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 a48c882b5ed0c37e9b2b7ddafe3d678b63e9fb30032f305362c776e037660257
MD5 92e50ec77ba01f74656c3461546e1b20
BLAKE2b-256 36c36adbb869f3dd83fe030fc593e6ffecd8de81baca0ff93cd1d658219a8648

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.4-cp39-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 babb235d8e519734f3b17796027c52d6420bffd62c4547584b6ec59b36588222
MD5 7ed01d4227d49d713026b80b4b5a9c54
BLAKE2b-256 75a1f8ee29e4d470a73235621fa1c5d47704b1ce8bbe93edbe298cf12831eb21

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.4-cp38-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 9d600711ad77921c4c425c62460d8b2d1c703fca76bc0814cdccf39954c5713a
MD5 ab855d6f127335fe318a366d3a122202
BLAKE2b-256 c751191056d88181f8127a9adfcb1f1edd5278a7ed2d5713818dd04453566b31

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.4-cp37-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 9d2aa0bf4e1da783eafd3858540e135f0b171974502c4d924761cbfb103daad2
MD5 97c99e49f3702d375535566b07e18cb5
BLAKE2b-256 612337946ca836292fbfde4cbae9334b3c3d933e6d9fa04c9ba6b93462b4bc5f

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