Instantly share code, notes, and snippets.

@sandeepraju /enqueue.py Secret
Created Sep 24, 2014

Embed
What would you like to do?
A simple request to enqueue a job into SHARQ Server. Requires Python Requests (http://docs.python-requests.org/en/latest/)
import json
import uuid
import requests # install request by running `pip install requests`
requests.post('http://localhost:8080/enqueue/sms/1/',
data=json.dumps({
# generate unique job_id for each request
'job_id': str(uuid.uuid4()),
'interval': 1000, # means a rate of 1 job per second
'payload': {'message': 'hello, world'}
}),
headers={'Content-Type': 'application/json'})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment