emptygif
Dil: Türkçe

Tüm diller ve framework'ler

Google Cloud Run functions (Python) Python

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

Google Cloud Run functions (Python) Python

Kurulum
pip install functions-framework
Dosya
main.py
Çalıştır
functions-framework --target=pixel --port=8080
import base64

import functions_framework

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


@functions_framework.http
def pixel(request):
    if request.path != "/pixel.gif":
        return "Not Found", 404
    return GIF, 200, {"Content-Type": "image/gif", "Cache-Control": "no-store"}

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: Google Cloud Run functions (Python)

Python için daha fazlası