Nimrodel
A simple Bottle.py-wrapper to provide HTTP API access to any python object.
Requirements
- Python 3.5 or higher
Quick Start
Install with
pip install nimrodel
Create your API with
from nimrodel import API
myapi = API()
You may optionally pass a port number with port=42, a path with path="api" and whether you want to serve on IPv4 (IPv6=False).
You can also give the API object an existing bottle server (server=bottleobject), in which case your API will be served on the existing server. It is heavily recommended to also pass a path variable to separate API from regular routing of your server.
You may also pass a custom function with parsedoc=yourfunction that takes your method as input and returns a dictionary with the values desc for the function description, params for a dictionary of parameter names mapped to a dictionary and returns for a dictionary of the return value. Both return and param dictionaries can have the keys type and desc for data type and description respectively. By default nimrodel will attempt to parse your docstring according to the reST standard (Sphinx).
Then make any class accessible with a decorator.
@myapi.apiclass("group")
class Group:
def __init__(self,name,apipath,songs):
# some stuff
self.__apiname__ = apipath
Any instance of that class is now accessible via the combination of class path and its individual path. Now just decorate the methods. All its arguments can be passed via URI query arguments.
@myapi.get("songs")
def get_songs(self,member):
return {"songs":[s["title"] for s in self.songs if member in s["performers"]]}
Now create an object and make sure it has an __apiname__ attribute:
e = Group("Exid","exid",exidsongs)
Then you can access its methods with simple HTTP calls like /group/exid/songs?member=Junghwa.
There is also an integrated graphical API explorer under /api_explorer.
Nimrodel also allows you to create a simple function-based API with the class EAPI.
For more in-depth exploration of the possibilities, refer to the file example.py included in the repository.
Metadata
Release files for nimrodel 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nimrodel-0.8.0.tar.gz | 23.4 kB | Without provenance | Details for nimrodel-0.8.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nimrodel-0.8.0-py3-none-any.whl | Python 3 | none | any | Details for nimrodel-0.8.0-py3-none-any.whl |
Total release size: 53.2 kB
Release files / nimrodel-0.8.0.tar.gz
| Download URL | nimrodel-0.8.0.tar.gz |
|---|---|
| Size | 23.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7fd5d5baf31730082a943c83b194c5ec07eaba3f4bff453fe3156c37e560b56d
|
|
BLAKE2b-256 checksum How to use checksums |
090ebb8ce1a078dbab7665452c03c99b38b56561c16ae22033cddd1b2571fe5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
|
Release files / nimrodel-0.8.0-py3-none-any.whl
| Download URL | nimrodel-0.8.0-py3-none-any.whl |
|---|---|
| Size | 29.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
08df134ac532e24189c037c61a2e4e7a817b198d604bcfc72f6eea5ef0e1a49d
|
|
BLAKE2b-256 checksum How to use checksums |
1174387a543d6495f3d4c84cd67519d31157acb62fe4b9bf33bff456d1cbd384
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
|
Security for nimrodel 0.8.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.