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.
Python WSGI and ASGI development server, optimized for API development and command-line usage.
License: Apache License 2.0
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.
The werkzeug-adapted reloader code has support for adding additional files on which to trigger reload. By default, the reloader looks only for *.py files, but a user may also wish to trigger reload when, say, a configuration file changes.
We would need to plumb through the support for extra files (probably through to the command-line) and add tests.
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"
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.