pallets/quart: An async Python micro framework for building web applications.
github.com·5d·
Discuss: Hacker News
FastAPI
Preview
Report Post

Quart

Quart is an async Python web application framework. Using Quart you can,

  • render and serve HTML templates,
  • write (RESTful) JSON APIs,
  • serve WebSockets,
  • stream request and response data,
  • do pretty much anything over the HTTP or WebSocket protocols.

Quickstart

Install from PyPI using an installer such as pip.

$ pip install quart

Save the following as app.py. This shows off rendering a template, returning JSON data, and using a WebSocket.

from quart import Quart, render_template, websocket

app = Quart(__name__)

@app.route("/")
async def hello():
return await render_template("index.html")

@app.route("/api")
async def json():
return {"hello": "world"}

@app.websocket("/ws")
async def ws():
while True:
await websocket.send("hello")
await web...

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help