@@ -0,0 +1,1782 @@
+# Copyright (c) 2014, William Pitcock %3Cnenolod@dereferenced.org%3E%0A#%0A# Permission to use, copy, modify, and/or distribute this software for any%0A# purpose with or without fee is hereby granted, provided that the above%0A# copyright notice and this permission notice appear in all copies.%0A#%0A# THE SOFTWARE IS PROVIDED %22AS IS%22 AND THE AUTHOR DISCLAIMS ALL WARRANTIES%0A# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF%0A# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR%0A# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES%0A# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN%0A# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF%0A# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.%0A%0Aimport simplejson as json%0Aimport eventlet%0Aimport socket%0A%0Afrom pprint import pprint%0A%0Aclass EventletKeyValueClient(object):%0A    def __init__(self, path='/tmp/keyvalued.sock'):%0A        self.path = path%0A%0A    def index(self, index, key, doc):%0A        payload = %7B%0A            'index': index,%0A            'key': key,%0A            '_source': doc%0A        %7D%0A        s = eventlet.connect(self.path, family=socket.AF_UNIX)%0A        s.send(bytes(json.dumps(payload) + '%5Cr%5Cn', 'UTF-8'))%0A        result = s.recv(16384)%0A        return json.loads(result)%0A%0A    def fetch(self, index, key):%0A        payload = %7B%0A            'index': index,%0A            'key': key,%0A        %7D%0A        s = eventlet.connect(self.path, family=socket.AF_UNIX)%0A        s.send(bytes(json.dumps(payload) + '%5Cr%5Cn', 'UTF-8'))%0A        result = s.recv(16384)%0A        return json.loads(result)%0A%0Akv_client = EventletKeyValueClient()%0Apprint(kv_client.index('test', 'test-1', %7B'status': 'keyvalued is cool'%7D))%0Apprint(kv_client.fetch('test', 'test-1'))%0A

add example client