Todos los lenguajes y frameworks
Microdot (CPython and MicroPython) Python
Un fragmento en Python para Microdot (CPython and MicroPython) que responde a las peticiones a /pixel.gif con el GIF vacío, decodificado una sola vez al arrancar.
Microdot (CPython and MicroPython) Python
import binascii # available on MicroPython as well as CPython
from microdot import Microdot
GIF = binascii.a2b_base64("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==")
app = Microdot()
@app.get("/pixel.gif")
async def pixel(request):
return GIF, 200, {"Content-Type": "image/gif", "Cache-Control": "no-store"}
app.run(port=8080)
Ejecutamos este fragmento y comparamos los bytes que devolvió.
Comprobar
curl -sI http://localhost:8080/pixel.gif
Sitio oficial: Microdot (CPython and MicroPython)