emptygif
Wika: Filipino

Lahat ng language at framework

BlackSheep Python

Isang Python snippet para sa BlackSheep na sumasagot sa mga request sa /pixel.gif gamit ang empty GIF, na isang beses lang dine-decode sa startup.

BlackSheep Python

I-install
pip install blacksheep uvicorn
File
app.py
Patakbuhin
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))

Pinatakbo namin ang snippet na ito at ikinumpara ang mga byte na ibinalik nito.

Suriin

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

Opisyal na site: BlackSheep

Iba pa sa Python