BlackSheep Python
Snippet Python untuk BlackSheep yang menjawab request ke /pixel.gif dengan empty GIF, yang di-decode sekali saat startup.
BlackSheep Python
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))
Kami telah menjalankan snippet ini dan membandingkan byte yang dikembalikannya.
Periksa
curl -sI http://localhost:8080/pixel.gif