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

File metadata

File hashes

Hashes for ppauth-0.1.6-cp313-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 6c1eee6934a76d7abb7e05b61bf2b6eceb5d2ccc7a0bb10398de1821300ef6d2
MD5 a51b0f970d81d58438511b3dc76085a0
BLAKE2b-256 0813035adf6291d28f1385fdfba96a292e73855fed036c20c1adb6a91d027a29

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.6-cp312-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 16ac00e31e178196584daa0bd1761f66a75017a7a47e29221c2f8588813df5d7
MD5 2dd0382c01f781f031d40315bd83def3
BLAKE2b-256 3d04a9e3d530dc3308a7eeb26eac03eb7eb46cba1f8f8dbecbbfdca8d69aea78

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.6-cp311-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 4cbf8177a0500a7089c97afe4e3fa5af88a721dae9831d5850a9567978301c7b
MD5 34520f0478de0a26acdedac72d12eb36
BLAKE2b-256 510fa8492cb7d07f0db9070b576d9966e39d7c52e194b44620a1a83b239da7dc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.6-cp310-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 286739cd3fac65d5a87e0b227f267869c7b3a9401603a9291b29d0918560c186
MD5 fc4d1b5b76b5a3de29473b81a01f8526
BLAKE2b-256 143f5e9b1830f18df936910f3b6c6ad72edc47981420ec0ac9a6e112d530d68a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.6-cp39-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 072aa5a49fc91d02b8ebe174edad6c8d77ed9bf2adb7f3395ff597ce5b22c715
MD5 b6965640ab1eeebaf4f7870f9c4678b0
BLAKE2b-256 11af971e872932997e22e4fc104c9d7ab4d64aa284b1ae24d3b6c2d51c9a6fe9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.6-cp38-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 1371762aa6873ffd6c019caffd575a020529af293712b59b6005043488296d59
MD5 1df79f669cf42d89f19afd449b05bf1d
BLAKE2b-256 4819ce1edc50fbbdb8c01d41e390a9db51202f4eaae5191e906eb2bbd373a16d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ppauth-0.1.6-cp37-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 fff1d0e367d4992aa5aedac3cb2240a43f045a14bb19ea0c61ceda9acc69294e
MD5 19b569360bb73f967ffe583eeaf27377
BLAKE2b-256 fa1e8eee5dda0c7ebfc859a67b8106eb9dcf3e8faf1f4d241e38a1cd838af850

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