sprinkler-util


Namesprinkler-util JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://github.com/henryivesjones/sprinkler/sprinkler_util/python
Summarysprinkler_util
upload_time2023-03-28 17:44:36
maintainer
docs_urlNone
authorHenry Jones
requires_python>=3.6
licenseGPL-3.0-or-later
keywords sprinkler
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Sprinkler Util
Utility functions for use within `sprinkler` python tasks.

## get_request_body
Use this function to get the request body if it exists.
Optionally convert it to JSON with the `as_json` argument.
Will return `None` if there is no request body.
```python
from sprinkler_util import get_request_body
body = get_request_body(as_json=True)
if body is None:
    raise Exception("NO REQUEST BODY")
...
```

## get_secret
Use this function to get a secret value. Case insensitive.
If the secret is not set, then a `SprinklerSecretNotSetException` will be raised.
```python
from sprinkler_util import get_secret

api_key = get_secret("GOOGLE_API_KEY")
...

```

## send_response
This function is used to send a response for a `call-and-response` type job.

**Only call this function once.**

Internally this function wraps what you pass to it in `json.dumps`.
```python
from sprinkler_util import send_response

send_response("hello world")
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/henryivesjones/sprinkler/sprinkler_util/python",
    "name": "sprinkler-util",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "sprinkler",
    "author": "Henry Jones",
    "author_email": "Henry Jones <henryivesjones@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/d2/1a/676af162d4e96c4d18e5714a3a35225fb3fdb3c2d0f155574bd031e80a77/sprinkler_util-0.1.3.tar.gz",
    "platform": null,
    "description": "# Sprinkler Util\nUtility functions for use within `sprinkler` python tasks.\n\n## get_request_body\nUse this function to get the request body if it exists.\nOptionally convert it to JSON with the `as_json` argument.\nWill return `None` if there is no request body.\n```python\nfrom sprinkler_util import get_request_body\nbody = get_request_body(as_json=True)\nif body is None:\n    raise Exception(\"NO REQUEST BODY\")\n...\n```\n\n## get_secret\nUse this function to get a secret value. Case insensitive.\nIf the secret is not set, then a `SprinklerSecretNotSetException` will be raised.\n```python\nfrom sprinkler_util import get_secret\n\napi_key = get_secret(\"GOOGLE_API_KEY\")\n...\n\n```\n\n## send_response\nThis function is used to send a response for a `call-and-response` type job.\n\n**Only call this function once.**\n\nInternally this function wraps what you pass to it in `json.dumps`.\n```python\nfrom sprinkler_util import send_response\n\nsend_response(\"hello world\")\n```\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-or-later",
    "summary": "sprinkler_util",
    "version": "0.1.3",
    "split_keywords": [
        "sprinkler"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3e3041caced20069524cca5d0d54d91e82643501aaae17274ac693bf8ca92605",
                "md5": "2cbbee2d547fb62de65da11a2fda9b9f",
                "sha256": "4c0febd0e27f896552fc79b3231778f2435ee29c1b80d8dca21ffc778b9a2fec"
            },
            "downloads": -1,
            "filename": "sprinkler_util-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2cbbee2d547fb62de65da11a2fda9b9f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 3092,
            "upload_time": "2023-03-28T17:44:34",
            "upload_time_iso_8601": "2023-03-28T17:44:34.851009Z",
            "url": "https://files.pythonhosted.org/packages/3e/30/41caced20069524cca5d0d54d91e82643501aaae17274ac693bf8ca92605/sprinkler_util-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d21a676af162d4e96c4d18e5714a3a35225fb3fdb3c2d0f155574bd031e80a77",
                "md5": "cd85fc0c53e3886d16a8fe5922ce89ac",
                "sha256": "f88191fc2e4ce4d6ae386cd071b2aa511daacc8b2dae159e0eac08378f09323b"
            },
            "downloads": -1,
            "filename": "sprinkler_util-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "cd85fc0c53e3886d16a8fe5922ce89ac",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 2783,
            "upload_time": "2023-03-28T17:44:36",
            "upload_time_iso_8601": "2023-03-28T17:44:36.359968Z",
            "url": "https://files.pythonhosted.org/packages/d2/1a/676af162d4e96c4d18e5714a3a35225fb3fdb3c2d0f155574bd031e80a77/sprinkler_util-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-28 17:44:36",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "sprinkler-util"
}
        
Elapsed time: 0.06008s