emptygif
Basa: Basa Jawa

Kabeh basa lan framework

Quart Python

Snippet Python kanggo Quart sing mangsuli request menyang /pixel.gif nganggo empty GIF, sing didekode sepisan nalika startup.

Quart Python

Instal
pip install quart
File
app.py
Lakokake
quart --app app run --port 8080
import base64

from quart import Quart, Response

GIF = base64.b64decode("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==")

app = Quart(__name__)


@app.get("/pixel.gif")
async def pixel():
    return Response(GIF, mimetype="image/gif", headers={"Cache-Control": "no-store"})

Snippet iki wis dilakokake lan byte asile wis dibandhingake.

Priksa

curl -sI http://localhost:8080/pixel.gif

Situs resmi: Quart

Liyane ing Python