本文整理匯總了Python中leancloud.init方法的典型用法代碼示例。如果您正苦於以下問題:Python leancloud.init方法的具體用法?Python leancloud.init怎麽用?Python leancloud.init使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類leancloud
的用法示例。
在下文中一共展示了leancloud.init方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: init
# 需要導入模塊: import leancloud [as 別名]
# 或者: from leancloud import init [as 別名]
def init(cls, client, convid=None, name=None, m=None, c=None, mu=None):
'''
:param client: realtime client
:param convid: conversation id
:param name: conversation name
:param m: conversation members
:param c: conversation creator clientid
:param mu: ??????????????? iOS ?? Windows Phone ?????
'''
instance = cls(client=client, convid=convid)
if convid:
conversation = instance._get_conversation_by_id(convid)
if not conversation:
raise RealtimeAPIError('404', 'Conversation not found')
return cls(client=client, convid=convid)
else:
params = {
"name": name,
"m": m,
"mu": mu,
}
conversation = self.client.create_conversation(json_body=params)
return cls(client=client, convid=conversation.get('objectId'))
示例2: setup_leancloud
# 需要導入模塊: import leancloud [as 別名]
# 或者: from leancloud import init [as 別名]
def setup_leancloud():
import leancloud
leancloud.init(
os.environ['LEANCLOUD_APP_ID'],
app_key=os.environ['LEANCLOUD_APP_KEY'],
master_key=os.environ['LEANCLOUD_APP_MASTER_KEY']
)
leancloud.use_master_key(False)
return leancloud.Engine(app.setup())
示例3: _get_conversation_by_id
# 需要導入模塊: import leancloud [as 別名]
# 或者: from leancloud import init [as 別名]
def _get_conversation_by_id(self, id):
leancloud.init(self.client.app_id, self.client.app_key)
_Conversation = leancloud.Object.extend('_Conversation')
# query = leancloud.Query('_Conversation')
# ????? Todo ? query ??
query = _Conversation.query
# ????????? objectId
try:
conversation = query.get(id)
except LeanCloudError as e:
raise RealtimeAPIError(e.code, e.error)
return conversation
示例4: leancloud_init
# 需要導入模塊: import leancloud [as 別名]
# 或者: from leancloud import init [as 別名]
def leancloud_init():
leancloud.init(constant.leancloud.APP_ID, constant.leancloud.APP_KEY)
示例5: __init__
# 需要導入模塊: import leancloud [as 別名]
# 或者: from leancloud import init [as 別名]
def __init__(self, app_id, app_key):
self.app_id = app_id
self.app_key = app_key
leancloud.init(app_id, app_key)