Skip to content

Instantly share code, notes, and snippets.

@tonijz
Created January 24, 2013 10:25
Show Gist options
  • Save tonijz/4619677 to your computer and use it in GitHub Desktop.
Save tonijz/4619677 to your computer and use it in GitHub Desktop.
import bottle
from bottle import route, run, request, response
import riak
import uuid
client = riak.RiakClient()
bucket = client.bucket('pixels')
@route('/')
def index():
# Need to grab and store whole url
data = {
'HTTP_ACCEPT' : request.environ["HTTP_ACCEPT"],
'HTTP_ACCEPT_ENCODING' : request.environ["HTTP_ACCEPT_ENCODING"],
'HTTP_ACCEPT_LANGUAGE' : request.environ["HTTP_ACCEPT_LANGUAGE"],
'HTTP_USER_AGENT' : request.environ["HTTP_USER_AGENT"],
'QUERY_STRING' : request.environ["QUERY_STRING"],
'REMOTE_ADDR' : request.environ["REMOTE_ADDR"],
'REQUEST_METHOD' : request.environ["REQUEST_METHOD"],
}
# create an id for the row
id = uuid.uuid1().hex
pixeldata = bucket.new(id, data)
pixeldata.store()
return ""
if __name__ == "__main__":
run(host='0.0.0.0', port=8080)
app = bottle.default_app()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment