Service Framework” • By Kenneth Reitz (Requests) • Kind of like an async Python web framework for humans • Not reinventing the wheel, but combining best practices • “Take Falcon, make it more like Flask & then give it some upgrades” – Kenneth Reitz @ Import This, Ep. 17
• Built-in static file server • Single-page webapp support • Built-in Requests for tests • Meta-framework – mount any ASGI / WSGI app at a subroute • GraphQL support … some upgrades?
implemented on top of uvicorn • async background tasks without Celery – no blocking import time @api.route("/incoming") async def receive_incoming(req, resp): @api.background.task def process_data(data): """Just sleeps for three seconds, as a demo.""" time.sleep(3) # Parse the incoming data as form-encoded. # Note: 'json' and 'yaml' formats are also automatically supported. data = await req.media() # Process the data (in the background). process_data(data) # Immediately respond that upload was successful. resp.media = {'success': True}
are some solutions, but it’s still early days • GINO – https://github.com/fantix/gino • a lightweight asynchronous ORM built on top of SQLAlchemy core for Python asyncio • Peewee-async – https://peewee-async.readthedocs.io/ • Responder comes with Marshmallow – https:// marshmallow.readthedocs.io/ (a serialisation standard)