Ask Solem c408d07b47 PEP8ify (using new version of pep8, 0.6.0) 14 years ago
..
README.rst 659389c873 Proofread readme in httpexample 15 years ago
__init__.py a76681f137 Added example: examples/httpexample with a simple http task. 15 years ago
manage.py c408d07b47 PEP8ify (using new version of pep8, 0.6.0) 14 years ago
settings.py 94de4a3d6a PEP8ify + pyflakes 15 years ago
urls.py a76681f137 Added example: examples/httpexample with a simple http task. 15 years ago
views.py a76681f137 Added example: examples/httpexample with a simple http task. 15 years ago

README.rst

======================
Webhook Task Example
======================

This example is a simple Django HTTP service exposing a single task
multiplying two numbers:

The multiply http callback task is in ``views.py``, mapped to a URL using
``urls.py``.

There are no models, so to start it do::

$ python manage.py runserver

To execute the task you could use curl::

$ curl http://localhost:8000/multiply?x=10&y=10

which then gives the expected JSON response::

{"status": "success": "retval": 100}


To execute this http callback task asynchronously you could fire up
a python shell with a properly configured celery and do:

>>> from celery.task.http import URL
>>> res = URL("http://localhost:8000/multiply").get_async(x=10, y=10)
>>> res.wait()
100


That's all!