Skip to main content

Nirum services as WSGI apps

Project description

Nirum services as WSGI apps

Build status Latest PyPI version

This package provides nirum_wsgi.WsgiApp class which adapts a given Nirum service to a WSGI application:

from youtservice import YourService
from nirum_wsgi import WsgiApp

class YourServiceImpl(YourService):
    ...

app = WsgiApp(YourServiceImpl())

There’s a development-purpose CLI launcher named nirum-server as well:

nirum-server -H 0.0.0.0 -p 8080 --debug 'yourserviceimpl:YourServiceImpl()'

Changelog

Version 0.2.0

Released on February 4, 2018.

  • Made parameters having an optional type possible to be omitted. [#205]

  • Added method dispatching by querystring pattern e.g., @http-resource(method="GET", path="/users?from={from}&to={to}"). [#130]

  • Added basic method dispatching by path pattern (URI template) through http-resource annotation, e.g., @http-resource(method="GET", path="/users/{login}/works/{work-id}/"). [#130]

  • Added allowed_origins and allowed_headers options for CORS to WsgiApp constructor. It supports simple wildcard (*) pattern syntax as well.

  • Added AnnotationError, NoJsonError, and ServiceMethodError exceptions.

  • Since returning a disallowed value which does not match to the return type is the fault the server-side made, the HTTP status code for the case became 500 Internal Server Error instead of 400 Bad Request. Also now it writes logs using logging module.

  • For the mistakes returning None from a method having non-null return type, now it became to show a more readable and debug-friendly message with a proper response instead of uncaught Python exception.

  • WsgiApp.url_map attribute was gone.

  • /ping/ resource was gone.

  • Fixed nirum-server command able to import a Python module/package from the current working directory (.; CWD).

Version 0.1.0

Released on July 10, 2017.

Download files

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

Source Distribution

nirum-wsgi-0.2.0.tar.gz (11.3 kB view hashes)

Uploaded Source

Built Distribution

nirum_wsgi-0.2.0-py2.py3-none-any.whl (12.1 kB view hashes)

Uploaded Python 2 Python 3

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