emptygif
Idioma: Español

Todos los lenguajes y frameworks

Quart Python

Un fragmento en Python para Quart que responde a las peticiones a /pixel.gif con el GIF vacío, decodificado una sola vez al arrancar.

Quart Python

Instalar
pip install quart
Archivo
app.py
Ejecutar
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"})

Ejecutamos este fragmento y comparamos los bytes que devolvió.

Comprobar

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

Sitio oficial: Quart

Más en Python