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.0.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 2Python 3

File details

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

File metadata

  • Download URL: django-task-api-1.2.0.tar.gz
  • Upload date:
  • Size: 11.3 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.0.tar.gz
Algorithm Hash digest
SHA256 c2ae5320c59078c0846b48f78f5a2201c3d49326ba2b556e64a2d74d47f9407b
MD5 a3be71faa08f9e73ca59d000c43aceee
BLAKE2b-256 89602fb9fd828ebe8cd21fe75d8174ecf793c894d3b988641253bcd1820de825

See more details on using hashes here.

File details

Details for the file django_task_api-1.2.0-py2.py3-none-any.whl.

File metadata

  • Download URL: django_task_api-1.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 14.4 kB
  • Tags: Python 2, 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.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 32e9c8ed43d4476878438c7e220adb1610f6c6de086ec96f3aedccc202b9de44
MD5 071caa2dbe17ec843104ae0a48d77d14
BLAKE2b-256 6383a282ec29768af1bd209a1ec7c3c1faac2bf575680e16593e247c6ae90127

See more details on using hashes here.

Supported by

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