# jo
Automatically making flask webservices from python objects
To install: ```pip install jo```
Note: You can find more modern and flexible version of `jo` in these packages: `py2http` and `qh`.
# Examples
## ObjWrapper
A class to wrap a "controller" class for a web service API.
It takes care of LRU caching objects constructed before (so they don't need to be re-constructed for every
API call), and converting request.json and request.args arguments to the types that will be recognized by
the method calls.
```
:param obj_constructor: a function that, given some arguments, constructs an object. It is this object
that will be wrapped for the webservice
:param obj_constructor_arg_names:
:param convert_arg: (processing) a dict keyed by variable names (str) and valued by a dict containing a
'type': a function (typically int, float, bool, and list) that will convert the value of the variable
to make it web service compliant
'default': A value to assign to the variable if it's missing.
:param The pattern that determines what attributes are allowed to be accessed. Note that patterns must be
complete patterns (i.e. describing the whole attribute path, not just a subset. For example, if you want
to have access to this.given.thing you, specifying r"this\.given" won't be enough. You need to specify
"this\.given.thing" or "this\.given\..*" (the latter giving access to all children of this.given.).
Allowed formats:
a re.compiled pattern
a string (that will be passed on to re.compile()
a dict with either
an "exclude", pointing to a list of patterns to exclude
an "include", pointing to a list of patterns to include
:param to_jdict: (input processing) Function to convert an output to a jsonizable dict
```
Raw data
{
"_id": null,
"home_page": "https://github.com/thorwhalen/uu/tree/master/jo",
"name": "jo",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": null,
"author": "Thor Whalen",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/e7/fa/1c803e3b4b99f5fddc7a92b693c104fc093b45303120965bcafc2e6a67fa/jo-0.0.6.tar.gz",
"platform": "any",
"description": "# jo\n\nAutomatically making flask webservices from python objects\n\nTo install:\t```pip install jo```\n\nNote: You can find more modern and flexible version of `jo` in these packages: `py2http` and `qh`.\n\n\n# Examples\n\n## ObjWrapper\n\nA class to wrap a \"controller\" class for a web service API.\nIt takes care of LRU caching objects constructed before (so they don't need to be re-constructed for every\nAPI call), and converting request.json and request.args arguments to the types that will be recognized by\nthe method calls.\n\n```\n:param obj_constructor: a function that, given some arguments, constructs an object. It is this object\n that will be wrapped for the webservice\n:param obj_constructor_arg_names:\n:param convert_arg: (processing) a dict keyed by variable names (str) and valued by a dict containing a\n 'type': a function (typically int, float, bool, and list) that will convert the value of the variable\n to make it web service compliant\n 'default': A value to assign to the variable if it's missing.\n:param The pattern that determines what attributes are allowed to be accessed. Note that patterns must be\n complete patterns (i.e. describing the whole attribute path, not just a subset. For example, if you want\n to have access to this.given.thing you, specifying r\"this\\.given\" won't be enough. You need to specify\n \"this\\.given.thing\" or \"this\\.given\\..*\" (the latter giving access to all children of this.given.).\n Allowed formats:\n a re.compiled pattern\n a string (that will be passed on to re.compile()\n a dict with either\n an \"exclude\", pointing to a list of patterns to exclude\n an \"include\", pointing to a list of patterns to include\n:param to_jdict: (input processing) Function to convert an output to a jsonizable dict\n```\n",
"bugtrack_url": null,
"license": "apache-2.0",
"summary": "Automatically making flask webservices from python objects",
"version": "0.0.6",
"project_urls": {
"Homepage": "https://github.com/thorwhalen/uu/tree/master/jo"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "74bb1ec7a30ae217d16aae4afaf210c5e90ead96855bd20b77394e859dd4a3cf",
"md5": "fb1a9c7da809d036bd9b553a922d0235",
"sha256": "e6d80341160893f78ab52b5e41cedd0d27b2905ee27bd4d293b0d324588dcc68"
},
"downloads": -1,
"filename": "jo-0.0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fb1a9c7da809d036bd9b553a922d0235",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 10249,
"upload_time": "2025-01-11T12:39:45",
"upload_time_iso_8601": "2025-01-11T12:39:45.095157Z",
"url": "https://files.pythonhosted.org/packages/74/bb/1ec7a30ae217d16aae4afaf210c5e90ead96855bd20b77394e859dd4a3cf/jo-0.0.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e7fa1c803e3b4b99f5fddc7a92b693c104fc093b45303120965bcafc2e6a67fa",
"md5": "8187846e826a40ec7a97e579cc3ddff9",
"sha256": "a6b436f0d667371ce16bf849a2f58b6856615721cfbe6fc63c6cd6191673f731"
},
"downloads": -1,
"filename": "jo-0.0.6.tar.gz",
"has_sig": false,
"md5_digest": "8187846e826a40ec7a97e579cc3ddff9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9462,
"upload_time": "2025-01-11T12:39:47",
"upload_time_iso_8601": "2025-01-11T12:39:47.186253Z",
"url": "https://files.pythonhosted.org/packages/e7/fa/1c803e3b4b99f5fddc7a92b693c104fc093b45303120965bcafc2e6a67fa/jo-0.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-11 12:39:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "thorwhalen",
"github_project": "uu",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "jo"
}