README.rst 791 B

123456789101112131415161718192021222324252627282930313233
  1. ======================
  2. Webhook Task Example
  3. ======================
  4. This example is a simple Django HTTP service exposing a single task
  5. multiplying two numbers:
  6. The multiply http callback task is in `views.py`, mapped to a URL using
  7. `urls.py`.
  8. There are no models, so to start it do::
  9. $ python manage.py runserver
  10. To execute the task you could use curl::
  11. $ curl http://localhost:8000/multiply?x=10&y=10
  12. which then gives the expected JSON response::
  13. {'status': 'success': 'retval': 100}
  14. To execute this http callback task asynchronously you could fire up
  15. a python shell with a properly configured celery and do::
  16. >>> from celery.task.http import URL
  17. >>> res = URL('http://localhost:8000/multiply').get_async(x=10, y=10)
  18. >>> res.wait()
  19. 100
  20. That's all!