emptygif
Basa: Basa Jawa

Kabeh basa lan framework

Microdot (CPython and MicroPython) Python

Snippet Python kanggo Microdot (CPython and MicroPython) sing mangsuli request menyang /pixel.gif nganggo empty GIF, sing didekode sepisan nalika startup.

Microdot (CPython and MicroPython) Python

Instal
pip install microdot
File
app.py
Lakokake
python app.py
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)

Snippet iki wis dilakokake lan byte asile wis dibandhingake.

Priksa

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

Situs resmi: Microdot (CPython and MicroPython)

Liyane ing Python