From 4d2157cdb5431d302fcfb7a8e29377c58f284345 Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Fri, 3 Aug 2012 13:20:19 +0200 Subject: [PATCH] Add the same treatment to the README file. --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index b2075c2..5d4818b 100644 --- a/README.md +++ b/README.md @@ -15,24 +15,30 @@ First, run a Redis server, of course: To put jobs on queues, you don't have to do anything special, just define your typically lengthy or blocking function: + ```python import requests def count_words_at_url(url): resp = requests.get(url) return len(resp.text.split()) + ``` You do use the excellent [requests][r] package, don't you? Then, create a RQ queue: + ```python from rq import Queue, use_connection use_connection() q = Queue() + ``` And enqueue the function call: + ```python from my_module import count_words_at_url result = q.enqueue(count_words_at_url, 'http://nvie.com') + ``` For a more complete example, refer to the [docs][d]. But this is the essence.