Skip to main content

A REST API for managing background tasks in Django

Project description

Django Task API lets you quickly write background tasks for your Django project and easily call then using the provided REST API, or the included JavaScript library.

What does it look like?

Tasks are defined as classes with typed input and output parameters, and a run function with the task implementation, to be called by a worker processes.

from task_api.tasks import Task
from task_api.params import ListParameter, NumberParameter

class SumNumbers(Task):
    name = 'sum'

    inputs = {
        'numbers': ListParameter(NumberParameter())
    }

    outputs = {
        'sum': NumberParameter()
    }

    def run(self, numbers):
        return sum(numbers)

Tasks are easily called and monitored in front-end code using the included JavaScript API. The API supports both promises (will Polyfill for older browsers) and traditional callbacks.

<script src="{% static 'django-task-api.min.js' %}"></script>

<script type="text/javascript">
    function sumTask(numbers) {
        TaskAPI
            .run('sum', {'numbers': numbers})
            .then(function(json) {
                console.log('Sum: ' + json.outputs.sum)
            })
    }
</script>

Next Steps

Project details


Download files

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

Source Distribution

django-task-api-1.2.2.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

django_task_api-1.2.2-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file django-task-api-1.2.2.tar.gz.

File metadata

  • Download URL: django-task-api-1.2.2.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.5

File hashes

Hashes for django-task-api-1.2.2.tar.gz
Algorithm Hash digest
SHA256 f0751234953e4f29065538f32d981fb3c68bba97f1c1b02d16cd8cff29691d82
MD5 f594a948b35a908c5dbe2da70f87a3d4
BLAKE2b-256 1fa9d42915d432fd9e82823e4d16b7b95361b1e8497e4811d1a6d9edb6552b97

See more details on using hashes here.

File details

Details for the file django_task_api-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: django_task_api-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.5

File hashes

Hashes for django_task_api-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3c20de6f484f6435d9489516386b2d24d2395ce29092c3624ea0c2d3bd171aa0
MD5 69de56c9138d1c8ca1f1229f7f8110ac
BLAKE2b-256 cabe6027bdf84e496a97934a8f19da3a3838bd688ecbc5f6011d82037018630a

See more details on using hashes here.

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