Skip to content

@alex-ethier /test_add_cb.py
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
couchbase perf tests
from couchbase.client import Couchbase
def insert_doc():
couchbase = Couchbase("localhost:8091", "account", "")
bucket = couchbase["account"]
key = "test_key"
val = "test_val"
bucket.set(key, 0, 0, val)
insert_doc()
import httplib2
import json
def insert_doc():
http = httplib2.Http()
http.add_credentials("Administrator", "password")
doc_name = "mydoc"
url = 'http://127.0.0.1:8092/account/%s' % doc_name
doc = {"doc_foo": "foo", "doc_bar": "bar"}
body = json.dumps(doc, sort_keys=True, indent=4)
response, content = http.request(
url,
'PUT',
body,
headers={'Content-type': 'application/json'}
)
insert_doc()
from couchbase.client import Couchbase
def get_doc():
couchbase = Couchbase("localhost:8091", "account", "")
bucket = couchbase["account"]
bucket.get("test_key")
get_doc()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.