emptygif
Basa: Basa Jawa

Kabeh basa lan framework

BlackSheep Python

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

BlackSheep Python

Instal
pip install blacksheep uvicorn
File
app.py
Lakokake
uvicorn app:app --port 8080
import base64

from blacksheep import Application, Content, Response, get

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

app = Application()


@get("/pixel.gif")
async def pixel() -> Response:
    return Response(200, [(b"Cache-Control", b"no-store")], Content(b"image/gif", GIF))

Snippet iki wis dilakokake lan byte asile wis dibandhingake.

Priksa

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

Situs resmi: BlackSheep

Liyane ing Python