emptygif
Sprache: Deutsch

Alle Sprachen und Frameworks

Quart Python

Ein Python-Snippet für Quart, das Anfragen an /pixel.gif mit dem leeren GIF beantwortet, das einmal beim Start dekodiert wird.

Quart Python

Installieren
pip install quart
Datei
app.py
Ausführen
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"})

Wir haben dieses Snippet ausgeführt und die zurückgegebenen Bytes verglichen.

Prüfen

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

Offizielle Website: Quart

Mehr in Python