A very simple, flask-based app to handle queued registration.
# Install requirements
$ pip install -r requirements.txt
# Create an empty database
$ python db.py
# Run the service
$ python app.py
>> import requests, json
>> requests.get('http://localhost:5000/registrations').json()
[]
>> requests.post('http://localhost:5000/registrations',
headers={'Content-Type': 'application/json'},
data=json.dumps({'email': 'email@address.com'}).json()
{
"created_on": "2014-06-28T23:01:24.312810",
"email": "email@address.com",
"invited": false,
"position": 1,
"waiting_before": 0
}
>> requests.get('http://localhost:5000/registrations/email@address.com').json()
{
"created_on": "2014-06-28T23:01:24.312810",
"email": "email@address.com",
"invited": false,
"position": 1,
"waiting_before": 0
}
Don't forget that you must past a Content-Type: application/json
header along
w/ your request!
Big thanks to Max Mautner (https://github.com/mmautner) for publishing his simple_api
project
which made it much easier for me to write Queuer.