BlackSheep Python
Ein Python-Snippet für BlackSheep, das Anfragen an /pixel.gif mit dem leeren GIF beantwortet, das einmal beim Start dekodiert wird.
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))
Wir haben dieses Snippet ausgeführt und die zurückgegebenen Bytes verglichen.
Prüfen
curl -sI http://localhost:8080/pixel.gif
Offizielle Website: BlackSheep