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.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.0.2.tar.gz (72.9 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.0.2-py3-none-any.whl (42.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django-task-api-1.0.2.tar.gz
  • Upload date:
  • Size: 72.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5

File hashes

Hashes for django-task-api-1.0.2.tar.gz
Algorithm Hash digest
SHA256 a63d14ec292c73e9e9c7675f697ed94b0eb8255d7a4c96535bba750474563c52
MD5 cee8322189fd7434212f8b854846c3e7
BLAKE2b-256 f63fbfd2c6695f86ab93f9012dbb4c83e760e66f7374e2fa35c7a5bfd06b4b68

See more details on using hashes here.

File details

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

File metadata

  • Download URL: django_task_api-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 42.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5

File hashes

Hashes for django_task_api-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7f7ff020d784ad38863fd696f1374ff932be01f3592f8a5ccb2eeb2211e78b9d
MD5 ca241a9c888d05bbafa9321c9e8392af
BLAKE2b-256 be48816617ff3f328a51cac665ee590965a776215dbc6cc1ed2ff5bb6f78b19b

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