Skip to main content

Build Status

codecov

Welcome to WSGIMagic!

The use of API Gateways backed by Serverless functions is currently expanding at a massive rate, however every provider has their own special way of presenting the HTTP request to the backend. This means a lot of very boring, very tedious work for us developers every time we want to use a new service. The goal of this package is to remove the barrier between the different cloud providers, and allow you to focus on wrting good old Python WSGI APIs.

The first environment that has been targeted is the combination of the AWS API Gateway ending as a proxy to AWS Lambda. Before you would need to find out how Amazon was structuring the incoming request information, and how to send that informaton back to get a proper response to the client. WSGIMagic allows you to handle everything with a basic decorator. The following example illustrates a very small example using Flask.

from flask import Flask

from wsgimagic.aws_lambda import lambda_magic

app = Flask(name)

@app.route('/hello', allowed_methods=['GET']) def hello() return 'Hello World'

@lambda_magic(app) def event_handler(event, context): pass

By using the lambda_magic decorator, the incoming API Gateway event will automatically be translated to the WSGI format and passed off to your application. For basic request handling, this is all you need to do. The lambda_magic decorator also allows you to specify additional response headers that need to be added, define the server name and port that your app will be told it is running under, and provide a custom error handler in case something goes really wrong with your requests. I will add more written documentation in the near future, however all of the functions should have decent doc strings that will provide any other available features.

Long term this package will aim to provide similar decorators for other Serverless providers who also do not pass HTTP messages along pre-translated to the WSGI format.

Release files for wsgimagic 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for wsgimagic 1.0.0
File Size Uploaded
wsgimagic-1.0.0.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for wsgimagic 1.0.0
File Interpreter ABI Platform
wsgimagic-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 10.7 kB

Release files / wsgimagic-1.0.0.tar.gz

Download URL wsgimagic-1.0.0.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2cc611f45e34bae22a75fc9719b3b12a700e390bd8ede78d82a7e8e59acfdc9e
BLAKE2b-256 checksum
How to use checksums
c7fc727c31f218c3105c97879a877711cbc7bede8d8f4de5e56869e6542dca4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5

Release files / wsgimagic-1.0.0-py3-none-any.whl

Download URL wsgimagic-1.0.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
843cfebbce54e320ed551b5dcca9df43a182558b2d23f3adba00d420ab427b1a
BLAKE2b-256 checksum
How to use checksums
c79daf8598bc228b25bf60ef9a7c8fea6d24f8f5a1232b051caed21ec6f644e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.5

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page