BlackSheep Python
/pixel.gif へのリクエストに空の GIF を返す、BlackSheep 用の Python スニペット。GIF は起動時に一度だけデコードします。
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))
このスニペットは実行し、返されたバイト列を照合しました。
確認
curl -sI http://localhost:8080/pixel.gif