Skip to content

Instantly share code, notes, and snippets.

@WillianFuks
Created October 31, 2017 19:25
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 WillianFuks/be439f6b72f4c390b60a1c17b7ed5431 to your computer and use it in GitHub Desktop.
Save WillianFuks/be439f6b72f4c390b60a1c17b7ed5431 to your computer and use it in GitHub Desktop.
Main application to receive CRON requests
import datetime
from flask import Flask, request
from google.appengine.api import taskqueue
from utils import process_url_date
app = Flask(__name__)
@app.route("/export_customers")
def export_customers():
"""When this method is invoked a new task is added to the queue where
eventually data from BigQuery is exported to GCS.
"""
date = process_url_date(request.args)
task = taskqueue.add(url='/queue_export',
target='worker',
params={'date': date})
return "Taks {} enqued, ETA {}".format(task.name, task.eta)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment