Giter VIP home page Giter VIP logo

updraft's Introduction

updraft

Falconry Updraft is a Python WSGI and ASGI development server, optimized for API development and command-line usage.

Warning

This project is in the early stages of an ongoing rewrite. The server is not functional yet.

updraft's People

Contributors

csojinb avatar jmvrbanac avatar kgriffs avatar vytas7 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

csojinb jeetjitsu

updraft's Issues

Add docs

  • API reference (preferably auto-generated)
  • tutorial
  • other stuff?

Add ipdb support

I should have recorded this issue a while ago. I attempted to add ipdb support, but it turns out the API for ipdb is not quite the same as the API for pdb in important ways (that I don't remember, because I discovered this 7 months ago and kept limited notes). However, ipdb is significantly nicer than pdb, so it would be nice to include it. Just choosing not to add in that complexity for the initial push.

run_dev_server swallows falcon.HTTPError and returns 500

I've been trying out updraft. werkzeug server to swallow falcon's error handling and reraise it as a 500 error.

import falcon
from marshmallow.exceptions import ValidationError
from marshmallow import Schema, fields
from updraft.dev_server import run_dev_server
import logging

logger = logging.getLogger(__name__)


class ErrorSchema(Schema):
    oid = fields.Int(dump_only=True)
    text = fields.Str(required=True)


class Error(object):
    # TODO: Implement

    def on_get(self, req, resp):
        try:
            ErrorSchema().load({"blarg": "Should raise an exception"})
        except ValidationError as e:
            logger.exception(e)
            raise falcon.HTTPBadRequest()


api = falcon.API()
api.add_route("/", Error())
run_dev_server(api, hostname="0.0.0.0", port=5000, use_reloader=True)

Example output

(publicity-zhV7bCdV) lmerg@mergner-darwin in publicity $ http http://localhost:5000/
HTTP/1.0 500 Internal Server Error
Date: Sun, 14 Oct 2018 00:11:48 GMT
Server: BaseHTTP/0.6 Python/3.7.0
content-length: 971
content-type: application/json; charset=UTF-8
vary: Accept

{
    "description": "Traceback (most recent call last):\n  File \"handle.py\", line 23, in on_get\n    ErrorSchema().load({\"blarg\": \"Should raise an exception\"})\n  File \"/Users/lmerg/code/.virtualenvs/publicity-zhV7bCdV/lib/python3.7/site-packages/marshmallow/schema.py\", line 529, in load\n    postprocess=True,\n  File \"/Users/lmerg/code/.virtualenvs/publicity-zhV7bCdV/lib/python3.7/site-packages/marshmallow/schema.py\", line 682, in _do_load\n    raise exc\nmarshmallow.exceptions.ValidationError: {'text': ['Missing data for required field.'], 'blarg': ['Unknown field.']}\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/Users/lmerg/code/contrivers/publicity/falcon/falcon/api.py\", line 247, in __call__\n    responder(req, resp, **params)\n  File \"handle.py\", line 28, in on_get\n    raise falcon.HTTPBadRequest()\nfalcon.errors.HTTPBadRequest\n",
    "title": "500 Internal Server Error"
}

Example expected output (with gunicorn)

(venv) $ http http://localhost:5000/
HTTP/1.1 400 Bad Request
Connection: close
Date: Sun, 14 Oct 2018 00:18:53 GMT
Server: gunicorn/19.9.0
content-length: 28
content-type: application/json; charset=UTF-8
vary: Accept

{
    "title": "400 Bad Request"
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.