Python Worker On Heroku Api

62 Views Asked by At

I am building an API on heroku using python and flask I am currently sending a post request and then the worker takes the parameters and starts processing and return the json response when it finishes

The question is how do I wait for the worker to finish and then send the response?

@app.route('/', methods=['POST'])
def automate():
    orderNumbers.clear()
    # email = request.form['email']
    email = request.args.get('email', None)
    # password = request.form['password']
    password = request.args.get('password', None)
    # orderNumber = request.form['orderNumber']
    orderNumber = request.args.get('orderNumber', None)
    orderNumbers.append(orderNumber)
    # return login_to_website(email, password, orderNumber)
    result = q.enqueue(login_to_website, email, password, orderNumber)
    job_key = result.get_id()
    return result
0

There are 0 best solutions below