def testConnstrFirstArg(self): info = self.cluster_info s = self.make_connargs()['connection_string'] cb = Bucket(s) d = cb.connect().addCallback(lambda x: self.assertTrue(cb.connected)) self.register_cleanup(cb) return d
import cb_status import settings socket_list = [] bucket_name = settings.BUCKET_NAME user = settings.USERNAME password = settings.PASSWORD if settings.AWS: node = settings.AWS_NODES[0] else: node = settings.AZURE_NODES[0] bucket = Bucket('couchbase://{0}/{1}'.format(node, bucket_name), username=user, password=password) fts_nodes = None fts_enabled = False nodes = [] n1ql_enabled = False xdcr_enabled = False class NodeStatusHandler(tornado.web.RequestHandler): def get(self): self.render("www/index.html") class CBStatusWebSocket(tornado.websocket.WebSocketHandler): def open(self):
from twisted.internet import reactor from txcouchbase.bucket import Bucket def on_view_rows(res): for row in res: print "Got row", row.key cb = Bucket('couchbase://localhost/beer-sample') d = cb.queryAll("beer", "brewery_beers", limit=20) d.addCallback(on_view_rows) reactor.run()
BUCKET_URL = "/pools/default/buckets" NODE_URL = "/pools/default/serverGroups" INDEX_URL = "/indexStatus" SERVICE_URL = "/pools/default/nodeServices" FTS_URL = "/api/index/cbex" XDCR_URL = "/pools/default/remoteClusters" USERNAME = settings.ADMIN_USER PASSWORD = settings.ADMIN_PASS bucket_name = settings.BUCKET_NAME user = settings.USERNAME password = settings.PASSWORD aws = settings.AWS bucket = Bucket('couchbase://{0}/{1}'.format(",".join(BOOTSTRAP_NODES), bucket_name), username=user, password=password) http_client = AsyncHTTPClient() def get_image_for_product(product): print("erm....get_image_for_product") return None @tornado.gen.coroutine def get_url(endpoint, host_list=bucket.server_nodes, raise_exception=False): exceptions = [] while True: for host in host_list: host = "http://" + host