Tous les langages et frameworks
Google Cloud Run functions (Python) Python
Un extrait Python pour Google Cloud Run functions (Python) qui répond aux requêtes sur /pixel.gif avec le GIF vide, décodé une seule fois au démarrage.
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"}
Nous avons exécuté cet extrait et comparé les octets qu’il a renvoyés.
Vérifier
curl -sI http://localhost:8080/pixel.gif
Site officiel: Google Cloud Run functions (Python)