klen / muffin

Muffin is a fast, simple and asyncronous web-framework for Python 3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@app.task descriptor not working

mobuleoagja opened this issue · comments

Describe the bug
run_after_response example does not work.
AttributeError: 'Application' object has no attribute 'task'

To Reproduce
Steps to reproduce the behavior:

from muffin import Application

app = Application()

@app.task
def send_email(email, message):
# send email here
pass

@app.route('/send')
async def send(request):

# Schedule any awaitable for later execution
app.run_after_response(send_email('user@email.com', 'Hello from Muffin!'))

# Return response to a client immediately
# The task will be executed after the response is sent
return "OK"

Desktop (please complete the following information):
muffin 0.100.1