emptygif
Lingua: Italiano

Tutti i linguaggi e framework

Google Cloud Run functions (Python) Python

Uno snippet Python per Google Cloud Run functions (Python) che risponde alle richieste a /pixel.gif con la GIF vuota, decodificata una sola volta all'avvio.

Google Cloud Run functions (Python) Python

Installa
pip install functions-framework
File
main.py
Esegui
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"}

Abbiamo eseguito questo snippet e confrontato i byte che ha restituito.

Verifica

curl -sI http://localhost:8080/pixel.gif

Sito ufficiale: Google Cloud Run functions (Python)

Altro in Python