本文整理汇总了Python中couchbase.bucket.Bucket.timeout方法的典型用法代码示例。如果您正苦于以下问题:Python Bucket.timeout方法的具体用法?Python Bucket.timeout怎么用?Python Bucket.timeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类couchbase.bucket.Bucket
的用法示例。
在下文中一共展示了Bucket.timeout方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_bucket
# 需要导入模块: from couchbase.bucket import Bucket [as 别名]
# 或者: from couchbase.bucket.Bucket import timeout [as 别名]
def get_bucket():
bucket_url = 'couchbase://%s/drinkmate_shadow?config_total_timeout=10.0'
if is_local:
try:
local_bucket= Bucket('couchbase://localhost/dm-test')
except:
local_bucket= Bucket(bucket_url %'127.0.0.1')
local_bucket.timeout=10
cb_bucket = local_bucket
else:
cloud_bucket = Bucket(bucket_url %couchbase_url)
cloud_bucket.timeout=10
cb_bucket = cloud_bucket
return cb_bucket
示例2: make_client
# 需要导入模块: from couchbase.bucket import Bucket [as 别名]
# 或者: from couchbase.bucket.Bucket import timeout [as 别名]
def make_client(self):
cb = None
while not cb:
# Try to connect via HTTP
try:
cb = Bucket(self.bucket_spec)
cb.transcoder = AlwaysJsonTranscoder()
cb.stats()
cb.timeout = 7.5
except CouchbaseNetworkError as e:
self.logger.exception(
'Got error while connecting. Sleeping for a bit')
sleep(1)
self._client = cb
示例3: create_connections
# 需要导入模块: from couchbase.bucket import Bucket [as 别名]
# 或者: from couchbase.bucket.Bucket import timeout [as 别名]
def create_connections(self):
"""
Create bucket connections. 5 bucket connections are created per instance.
:return: Nothing
"""
for i in range(0, self.threads):
if self.cb_version > '5':
cluster = Cluster(self.spec)
auth = PasswordAuthenticator(self.user, self.password)
cluster.authenticate(auth)
bucket = cluster.open_bucket(self.bucket_name, lockmode=LOCKMODE_WAIT)
bucket.timeout = self.timeout
self.connections.append(bucket)
else:
bucket = Bucket('{0}/{1}'.format(self.spec, self.bucket_name), lockmode=LOCKMODE_WAIT)
bucket.timeout = self.timeout
self.connections.append(bucket)
示例4: Bucket
# 需要导入模块: from couchbase.bucket import Bucket [as 别名]
# 或者: from couchbase.bucket.Bucket import timeout [as 别名]
import urllib2
# Create your views here.
# Import csrf exempt
from django.views.decorators.csrf import csrf_exempt
# Couchbase setup
couchbase_url = settings.COUCHBASE_SERVER
base = "http://%s:8092/"
sendgrid_apikey = "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"
cloud_bucket = Bucket("couchbase://%s/drinkmate_shadow?config_total_timeout=20.0" % (couchbase_url))
cloud_bucket.timeout = 20
cb_bucket = cloud_bucket
couchbase_user_url = "http://%s:4985/sync_gateway/_user/" % (couchbase_url)
uname_exists_url = "http://%s:4985/sync_gateway/_user/" % (couchbase_url)
@csrf_exempt
def create_user(request):
"""
Validates that input contains email, password, username
computes admin_channels, creates authorization doc.
construct, create user profile doc
"""
create_user_doc = False
try:
示例5: Nominatim
# 需要导入模块: from couchbase.bucket import Bucket [as 别名]
# 或者: from couchbase.bucket.Bucket import timeout [as 别名]
_geolocator = Nominatim()
import iso3166
from iso3166 import countries
from ipware.ip import get_real_ip, get_ip
import os
#Connecting to Drinkmate local database:
couchbase_url=settings.COUCHBASE_SERVER
#couchbase_url="192.168.31.40" #Use when in lab
base='http://%s:8092/'
if is_local:
try:
local_bucket= Bucket('couchbase://localhost/dm-test')
except:
local_bucket= Bucket('couchbase://localhost/drinkmate_shadow?config_total_timeout=20.0')
local_bucket.timeout=20
cb_bucket = local_bucket
else:
cloud_bucket = Bucket('couchbase://'+couchbase_url+'/drinkmate_shadow?config_total_timeout=20.0')
cloud_bucket.timeout=20
#cb_bucket = local_bucket
cb_bucket = cloud_bucket
''' Mapbox currently using comic map - JT has access '''
MAPBOX={
'ID':'tolster710.nipf4nb8',
'TOKEN':'pk.eyJ1IjoidG9sc3RlcjcxMCIsImEiOiJjaWY1dGJ4OG4wMmwwc2trdHptbTZ4c3p0In0.sPrSKqAAJNUwGw8lxumkBQ'
}
### need a string constructor for the urls
# one for base url construction, added to a variable query