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.

Source Distribution

oswald-0.0.4.tar.gz (4.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page