Google Cloud Run functions (Python) Python
A Python snippet for Google Cloud Run functions (Python) that answers requests for /pixel.gif with the empty GIF, decoded once at startup.
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"}
We ran this snippet and compared the bytes it returned.
Check it
curl -sI http://localhost:8080/pixel.gif
Official site: Google Cloud Run functions (Python)