本文整理汇总了Python中storyengine.model.account.Account.api_convert方法的典型用法代码示例。如果您正苦于以下问题:Python Account.api_convert方法的具体用法?Python Account.api_convert怎么用?Python Account.api_convert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类storyengine.model.account.Account
的用法示例。
在下文中一共展示了Account.api_convert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from storyengine.model.account import Account [as 别名]
# 或者: from storyengine.model.account.Account import api_convert [as 别名]
def post(self):
accountid = self.session.get('accountid')
account = Account.get_by_accountid(accountid)
if 1 != account.mod:
return
testcode = self.request.get('testcode')
assert(testcode)
d = json.loads(testcode)
assert(d)
d['name'] = "asdf"
det = Account.api_convert(d['facebookid'],
d['access_token'],
None,
d['name'],
d['guestid'])
self.redirect(self.request.url + 'input?result='+str(det))
示例2: post
# 需要导入模块: from storyengine.model.account import Account [as 别名]
# 或者: from storyengine.model.account.Account import api_convert [as 别名]
def post(self):
if False == (USER_AGENT in self.request.headers["User-Agent"]):
self.response.out.write(json.dumps({'success':False}))
return
self.response.headers['Content-Type'] = 'application/json'
facebookID = self.request.get('facebookid')
guestID = self.request.get('guestid')
name = self.request.get('name')
access_token = self.request.get('access_token')
expiration_date = self.request.get('expiration_date')
if "" == access_token:
access_token = None
if "" == expiration_date:
expiration_date = None
if None == facebookID :
ret = {}
ret['err'] = 'facebookid'
self.response.out.write(json.dumps(ret))
return
if None == guestID :
ret = {}
ret['err'] = 'guestid'
self.response.out.write(json.dumps(ret))
return
if None == name :
ret = {}
ret['err'] = 'name'
self.response.out.write(json.dumps(ret))
return
ret = Account.api_convert(facebookID,access_token,expiration_date,name,guestID)
if False == ret['success']:
ret = Account.api_login(facebookID,access_token,expiration_date,name)
if None!=ret['id']:
del ret['id']
self.response.out.write(json.dumps(ret))