Skip to main content

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

jo-0.0.7.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jo-0.0.7-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

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

Hashes for jo-0.0.7.tar.gz
Algorithm Hash digest
SHA256 af4e3711022b19ba54f4a32287faffed322b603c220ad44f8f330e2cba1e5d2a
MD5 75b74cd2880f8dad0127b055d05161d0
BLAKE2b-256 f417add952a3b2853c86296bdb1051a128509edcb3a408aaa86121dedba228d9

See more details on using hashes here.

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

Hashes for jo-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 9675c3663e6b1c410b4ee28160cdf1f3262718336ad44620a26a689ade2dc428
MD5 708e9ed4984d3b1cd4a7d8594dd66c63
BLAKE2b-256 1457fb8b7db93988bd44d77e69c7c5057f10c72e7af4f880828596da541a286c

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