Skip to main content

A Flask extension for defining and running tasks

Project description

flask-taskx

Flask-TaskX is an extension for Flask that adds the capability of running tasks within the context of your Flask applications. If you are familiar with Flask, Flask-TaskX should be easy to pick up. It provides a coherent collection of decorators and tools to define and execute asynchronous tasks.

Installation

You can install Flask-TaskX with pip:

$ pip install flask-taskx

or with easy_install:

$ easy_install flask-taskx

Quick start

With Flask-TaskX, you define the task worker by instantiating a BackgroundTaskWorker and with this instance define all tasks to be executed later in the background.

from flask import Flask
from flask_taskx import BackgroundTaskWorker

app = Flask(__name__)
task_worker = BackgroundTaskWorker(app)


@task_worker.define_task
def email_task(**kwargs):

    response = send_message(**kwargs)
    return response


@app.route('/email_send')
def email_send():
   email_task.apply(email="test@test.com")

task_worker.start()
app.run()

Documentation

The documentation is hosted on Read the Docs

Project details


Release history Release notifications | RSS feed

This version

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flask-taskx-1.0.tar.gz (2.4 kB view hashes)

Uploaded Source

Built Distributions

flask_taskx-1.0-py3-none-any.whl (3.1 kB view hashes)

Uploaded Python 3

Flask_TaskX-1.0-py3-none-any.whl (3.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page