emptygif
Dil: Türkçe

Tüm diller ve framework'ler

Bottle Python

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

Bottle Python

Kurulum
pip install bottle
Dosya
app.py
Çalıştır
python app.py
import base64

from bottle import Bottle, response

GIF = base64.b64decode("R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==")

app = Bottle()


@app.get("/pixel.gif")
def pixel():
    response.content_type = "image/gif"
    response.set_header("Cache-Control", "no-store")
    return GIF


if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8080)

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: Bottle

Python için daha fazlası