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
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)