Google Cloud Run functions (Python) Python
Snippet na Python don Google Cloud Run functions (Python) da ke amsa requests zuwa /pixel.gif da empty GIF, wanda ake decoding ɗinsa sau ɗaya lokacin farawa.
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"}
Mun gudanar da wannan snippet kuma mun kwatanta bytes ɗin da ya mayar.
Duba shi
curl -sI http://localhost:8080/pixel.gif
Shafin hukuma: Google Cloud Run functions (Python)