本文整理汇总了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)