Skip to content

Instantly share code, notes, and snippets.

@Miserlou
Created March 29, 2017 17:09
Show Gist options
  • Save Miserlou/48ac23deb60cd21a74fecd5f1d558a8c to your computer and use it in GitHub Desktop.
Save Miserlou/48ac23deb60cd21a74fecd5f1d558a8c to your computer and use it in GitHub Desktop.
zappa_task_example.py
import flask
from zappa.async import task
@task
def make_pie():
""" This takes a long time! """
ingredients = get_ingredients()
pie = bake(ingredients)
deliver(pie)
@flask.route('/api/order/pie')
def order_pie():
""" This returns immediately! """
make_pie()
return "Your pie is being made!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment