emptygif
Dil: Türkçe

Tüm diller ve framework'ler

BlackSheep Python

BlackSheep için, /pixel.gif isteklerine başlangıçta bir kez çözülen boş GIF ile yanıt veren bir Python örneği.

BlackSheep Python

Kurulum
pip install blacksheep uvicorn
Dosya
app.py
Çalıştır
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))

Bu örneği çalıştırıp döndürdüğü baytları karşılaştırdık.

Kontrol et

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

Resmî site: BlackSheep

Python için daha fazlası