Skip to main content

Organize and rapidly/easily create endpoints for an API. Built on top of Falcon.

Project description

Oswald

Easy to create and maintain endpoints for an API. Built on top of Falcon.

falconBadge pythonBadge Actions Status


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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for oswald, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size oswald-0.0.4.tar.gz (4.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page