ppauth


Nameppauth JSON
Version 0.1.10 PyPI version JSON
download
home_pageNone
SummaryPython bindings for ProxyAuth authentication via Rust
upload_time2025-07-11 20:39:13
maintainerNone
docs_urlNone
authorvBlackOut
requires_python>=3.7
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
<div align="center">
<h1>PyProxyAuth</h1>
<img src='https://github.com/ProxyAuth/ppauth/raw/main/images/ppauth.png' width="300px" height="300px"/><br>
<img src='https://github.com/ProxyAuth/ppauth/raw/main/images/totp_client.png' width="500px" height="500px"/>
</div>
<br>
A lightweight Python library to authenticate and retrieve tokens via ProxyAuth.  

## install 
```
pip install ppauth
```

## usage

```python
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'
```


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ppauth",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": null,
    "author": "vBlackOut",
    "author_email": null,
    "download_url": null,
    "platform": null,
    "description": "\r\n<div align=\"center\">\r\n<h1>PyProxyAuth</h1>\r\n<img src='https://github.com/ProxyAuth/ppauth/raw/main/images/ppauth.png' width=\"300px\" height=\"300px\"/><br>\r\n<img src='https://github.com/ProxyAuth/ppauth/raw/main/images/totp_client.png' width=\"500px\" height=\"500px\"/>\r\n</div>\r\n<br>\r\nA lightweight Python library to authenticate and retrieve tokens via ProxyAuth.  \r\n\r\n## install \r\n```\r\npip install ppauth\r\n```\r\n\r\n## usage\r\n\r\n```python\r\nimport ppauth\r\n\r\nppauth.auth(\r\n    host=\"127.0.0.1\", port=8080,\r\n    username=\"admin\", password=\"admin123\",\r\n    \r\n    # Optional TOTP code (used if two-factor authentication is enabled).\r\n    # Note: If using TOTP, the server should issue a token with a minimum 1-day expiration.\r\n    # As a developer, you should provide a new TOTP code each time the token expires.\r\n    totp=\"56845\",\r\n    \r\n    timezone=\"Europe/Paris\" \r\n)\r\n\r\ntoken = ppauth.token()\r\ntoken = ppauth.token(renew=True) # Automatically re-authenticates and returns a new token if the previous one has expired.\r\nlease_token = ppauth.lease_token()\r\n\r\nprint({\"token\": token, \"expire_at\": lease_token})\r\n\r\n# result\r\n# {\"expire_at\": 16500,\"token\":\"ZoHAauGmCyxjq6+1sfVbqy...\"}\r\n\r\n# for easy use method GET\r\n# Use the route defined in routes.yml within your backend delivery. \r\n# You don't need to manually include the token in the headers it's handled automatically\r\nheaders = {\"user-agent\": \"ppauth/0.1.1\"}\r\nparams = {\"params_key\": \"my_send_request_params_via_get\"}\r\n\r\nppauth.get(\r\n    \"/app\",          # The API route (relative path) to call on the authenticated backend\r\n    headers=headers, # Optional custom HTTP headers (Python dict), e.g. {\"X-User\": \"admin\"}\r\n    params=params,   # Optional query parameters (Python dict), e.g. {\"limit\": \"10\"}\r\n    verify=False,    # Disable TLS certificate verification (useful for self-signed certs)\r\n    timeout=5,       # Max duration (in seconds) to wait for a response before failing\r\n    retry=5          # Number of retry attempts if the request fails (timeout or server error)\r\n)\r\n\r\n# result\r\n# 'ok'\r\n\r\n# you are similar for POST method\r\nheaders = {\"user-agent\": \"ppauth/0.1.1\"}\r\nbody = {\"body_key\": \"my_send_request_data_via_post\"}\r\njson = {\"json_key\": \"my_send_request_json_data_via_post\"}\r\n\r\nppauth.post(\r\n    \"/app\",          # The API route (relative path) to call on the authenticated backend\r\n    headers=headers, # Optional custom HTTP headers (Python dict), e.g. {\"Content-Type\": \"application/json\"}\r\n    body=body,       # (If implemented) Optional raw body content (usually a string or bytes)\r\n    json=json,       # Optional JSON body (Python dict) that will be serialized and sent as application/json\r\n    timeout=5,       # Max duration (in seconds) to wait for a response before raising a timeout error\r\n    verify=False,    # Disable TLS certificate verification (useful for self-signed certificates)\r\n    retry=2          # Number of retry attempts if the request fails (e.g., timeout or 5xx server errors)\r\n)\r\n\r\n# result\r\n# 'ok'\r\n```\r\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "Python bindings for ProxyAuth authentication via Rust",
    "version": "0.1.10",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b087a8fc11346fa603dca24e23ae40986e3c3a27ef98df6f6ae0c62251286631",
                "md5": "603ada72b02be4291a955048b16af37a",
                "sha256": "4b479e1658bf1efb77d3dd01c18730d32bc4cc175dc4fbaa621dcf9d0cc5978e"
            },
            "downloads": -1,
            "filename": "ppauth-0.1.10-cp310-abi3-manylinux_2_34_x86_64.whl",
            "has_sig": false,
            "md5_digest": "603ada72b02be4291a955048b16af37a",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.7",
            "size": 5343349,
            "upload_time": "2025-07-11T20:39:13",
            "upload_time_iso_8601": "2025-07-11T20:39:13.170238Z",
            "url": "https://files.pythonhosted.org/packages/b0/87/a8fc11346fa603dca24e23ae40986e3c3a27ef98df6f6ae0c62251286631/ppauth-0.1.10-cp310-abi3-manylinux_2_34_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "5d8f6429f9d6fcff3272d71d299fd79af12c8daba4d8cd2fca23e58583b1758a",
                "md5": "0ee6be04c8bcda7cbca8241eca8f92c8",
                "sha256": "5b9187b727e96c37ca4edd1b509e6976d49dcd9322eef8e3c62274125186ac91"
            },
            "downloads": -1,
            "filename": "ppauth-0.1.10-cp311-abi3-manylinux_2_34_x86_64.whl",
            "has_sig": false,
            "md5_digest": "0ee6be04c8bcda7cbca8241eca8f92c8",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.7",
            "size": 5343094,
            "upload_time": "2025-07-11T20:39:15",
            "upload_time_iso_8601": "2025-07-11T20:39:15.399684Z",
            "url": "https://files.pythonhosted.org/packages/5d/8f/6429f9d6fcff3272d71d299fd79af12c8daba4d8cd2fca23e58583b1758a/ppauth-0.1.10-cp311-abi3-manylinux_2_34_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "daa978ed94107e00266c1f973f4095f4bb88d3ea1f736a1616b8ffab877f380a",
                "md5": "6d3b1cf030c2a4701fc829d9f020dea9",
                "sha256": "4be756766856a79cf64ce2334690368f7117b54ec7dcc8121823455944b55606"
            },
            "downloads": -1,
            "filename": "ppauth-0.1.10-cp312-abi3-manylinux_2_34_x86_64.whl",
            "has_sig": false,
            "md5_digest": "6d3b1cf030c2a4701fc829d9f020dea9",
            "packagetype": "bdist_wheel",
            "python_version": "cp312",
            "requires_python": ">=3.7",
            "size": 5344635,
            "upload_time": "2025-07-11T20:39:17",
            "upload_time_iso_8601": "2025-07-11T20:39:17.765785Z",
            "url": "https://files.pythonhosted.org/packages/da/a9/78ed94107e00266c1f973f4095f4bb88d3ea1f736a1616b8ffab877f380a/ppauth-0.1.10-cp312-abi3-manylinux_2_34_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e9a8359920abdd7e2cf9732000d0e53e3470779c61241bd38c3a9173f44ccecd",
                "md5": "ae6eb47a0564152bc3bed00b07da5161",
                "sha256": "6fec1e8c4c3632d6781f6dcedb6e5342454980586416522035ae0cbc45913d02"
            },
            "downloads": -1,
            "filename": "ppauth-0.1.10-cp313-abi3-manylinux_2_34_x86_64.whl",
            "has_sig": false,
            "md5_digest": "ae6eb47a0564152bc3bed00b07da5161",
            "packagetype": "bdist_wheel",
            "python_version": "cp313",
            "requires_python": ">=3.7",
            "size": 5344633,
            "upload_time": "2025-07-11T20:39:19",
            "upload_time_iso_8601": "2025-07-11T20:39:19.983102Z",
            "url": "https://files.pythonhosted.org/packages/e9/a8/359920abdd7e2cf9732000d0e53e3470779c61241bd38c3a9173f44ccecd/ppauth-0.1.10-cp313-abi3-manylinux_2_34_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "b17c86fb22a25daa0771a91600ca2d4e4450e460ccf584828a65385b3eb1e892",
                "md5": "c706d1264898f47bfc56a6c8ee4ef31b",
                "sha256": "115f490c827408f721b07748094783a68efc78256deb8db546fa5e7669ebca34"
            },
            "downloads": -1,
            "filename": "ppauth-0.1.10-cp37-abi3-manylinux_2_34_x86_64.whl",
            "has_sig": false,
            "md5_digest": "c706d1264898f47bfc56a6c8ee4ef31b",
            "packagetype": "bdist_wheel",
            "python_version": "cp37",
            "requires_python": ">=3.7",
            "size": 5345796,
            "upload_time": "2025-07-11T20:39:22",
            "upload_time_iso_8601": "2025-07-11T20:39:22.495131Z",
            "url": "https://files.pythonhosted.org/packages/b1/7c/86fb22a25daa0771a91600ca2d4e4450e460ccf584828a65385b3eb1e892/ppauth-0.1.10-cp37-abi3-manylinux_2_34_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "adcc52a97effa68f0e772c04164b74a059aeba36cd7828a2f28ec845548e749a",
                "md5": "dc3be15b92923a4030f26cbab8725b8f",
                "sha256": "3e797baef0fb4011b33c9c6b287b881d8da0c3d1f6eeac36ab9a90476e551943"
            },
            "downloads": -1,
            "filename": "ppauth-0.1.10-cp38-abi3-manylinux_2_34_x86_64.whl",
            "has_sig": false,
            "md5_digest": "dc3be15b92923a4030f26cbab8725b8f",
            "packagetype": "bdist_wheel",
            "python_version": "cp38",
            "requires_python": ">=3.7",
            "size": 5345790,
            "upload_time": "2025-07-11T20:39:24",
            "upload_time_iso_8601": "2025-07-11T20:39:24.955803Z",
            "url": "https://files.pythonhosted.org/packages/ad/cc/52a97effa68f0e772c04164b74a059aeba36cd7828a2f28ec845548e749a/ppauth-0.1.10-cp38-abi3-manylinux_2_34_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "027a4d1966cfe138967150c345bdc3af3d521dd8d438465404c641be3d2be232",
                "md5": "9d3278800bca65c822244e347c8ba825",
                "sha256": "88cf4a52e0b320b75be073e75126f2e9bfac62c3d8cb0a9910b8aebf6eb17c86"
            },
            "downloads": -1,
            "filename": "ppauth-0.1.10-cp39-abi3-manylinux_2_34_x86_64.whl",
            "has_sig": false,
            "md5_digest": "9d3278800bca65c822244e347c8ba825",
            "packagetype": "bdist_wheel",
            "python_version": "cp39",
            "requires_python": ">=3.7",
            "size": 5345698,
            "upload_time": "2025-07-11T20:39:27",
            "upload_time_iso_8601": "2025-07-11T20:39:27.246248Z",
            "url": "https://files.pythonhosted.org/packages/02/7a/4d1966cfe138967150c345bdc3af3d521dd8d438465404c641be3d2be232/ppauth-0.1.10-cp39-abi3-manylinux_2_34_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-11 20:39:13",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "ppauth"
}
        
Elapsed time: 0.45867s