Automatically making flask webservices from python objects
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jo-0.0.7.tar.gz.
File metadata
- Download URL: jo-0.0.7.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af4e3711022b19ba54f4a32287faffed322b603c220ad44f8f330e2cba1e5d2a
|
|
| MD5 |
75b74cd2880f8dad0127b055d05161d0
|
|
| BLAKE2b-256 |
f417add952a3b2853c86296bdb1051a128509edcb3a408aaa86121dedba228d9
|
File details
Details for the file jo-0.0.7-py3-none-any.whl.
File metadata
- Download URL: jo-0.0.7-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9675c3663e6b1c410b4ee28160cdf1f3262718336ad44620a26a689ade2dc428
|
|
| MD5 |
708e9ed4984d3b1cd4a7d8594dd66c63
|
|
| BLAKE2b-256 |
1457fb8b7db93988bd44d77e69c7c5057f10c72e7af4f880828596da541a286c
|