Skip to content

Instantly share code, notes, and snippets.

@robcowie
Created May 7, 2020 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robcowie/fd3b464f640416d348bbcca14e95d887 to your computer and use it in GitHub Desktop.
Save robcowie/fd3b464f640416d348bbcca14e95d887 to your computer and use it in GitHub Desktop.
Tiny wrapper to serve a cloud function handler locally with Flask
import os, sys
from pathlib import Path
from flask import Flask, request
sys.path.append(Path(".").absolute().as_posix())
from main import handler
app = Flask("name")
@app.route("/", methods=["POST"])
def wrapper():
"""Wrap the cloud function handler."""
return handler(request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment