Last updated:
0 purchases
oswald 0.0.4
Easy to create and maintain endpoints for an API. Built on top of Falcon.
Automatic detection and addition of new endpoints. disable any endpoint in one line
Sample Layout
📁Endpoints (Directory)
↳ - __init__.py
- ShoppingCart.py
- WebVideos.py
- Announcements.py
Sample Endpoint file
class SampleResource:
# Still Falcon
def on_get(req, resp):
resp.media = {
"message": "hello world"
}
# Required Class + Variables in order for Oswald to detect it's valid.
class Endpoint:
API_ENDS = [
{
"endpoint": "/Sample",
"endpointObj": SampleResource
}
]
Usage with Gunicorn/Others
Oswald simply returns a normal falcon WGSI object with the additions and removals.
import oswald
stage_1 = oswald.Oswald("moduleFolder")
# Falcon object can be accessed
api = stage_1.api
Sample Output
2019-11-06 22:57:50.490 | DEBUG | helpers.checkModuleFolder:detect_api_endpoints:21 - Ignoring Init.
2019-11-06 22:57:50.491 | INFO | helpers.checkModuleFolder:detect_api_endpoints:34 - Importing modules.sampleResource.
2019-11-06 22:57:50.491 | INFO | helpers.checkModuleFolder:detect_api_endpoints:36 - Imported modules.sampleResource
[-] Endpoints: 1
[-] Generating API Object.
[-] Attemping addition for /sample.
[-] 1 resource(s) added.
[-] Initalizing Webserver.
Serving on http://localhost:8874
Installation
pip install oswald
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.