当前位置: 首页>>代码示例>>Python>>正文


Python Account.api_login方法代码示例

本文整理汇总了Python中storyengine.model.account.Account.api_login方法的典型用法代码示例。如果您正苦于以下问题:Python Account.api_login方法的具体用法?Python Account.api_login怎么用?Python Account.api_login使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在storyengine.model.account.Account的用法示例。


在下文中一共展示了Account.api_login方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: post

# 需要导入模块: from storyengine.model.account import Account [as 别名]
# 或者: from storyengine.model.account.Account import api_login [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')
		name = self.request.get('name')
		access_token = self.request.get('access_token')
		expiration_date = self.request.get('expiration_date')
		logging.info('id[%s] name[%s]',facebookID, name)

		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 == name :
			ret = {}
			ret['err'] = 'name'
			self.response.out.write(json.dumps(ret))
			return
		ret = Account.api_login(facebookID,access_token,expiration_date,name)
		if None != ret['id']:
			del ret['id']
		ret['id'] = facebookID
		self.response.out.write(json.dumps(ret))
开发者ID:zedoul,项目名称:storyengine-gae,代码行数:33,代码来源:account.py

示例2: post

# 需要导入模块: from storyengine.model.account import Account [as 别名]
# 或者: from storyengine.model.account.Account import api_login [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)
		exp_date = None
		det = Account.api_login(d['facebookid'],d['access_token'],exp_date,d['name'])
		self.redirect(self.request.url + 'input?result='+str(det))
开发者ID:zedoul,项目名称:storyengine-gae,代码行数:15,代码来源:apitest.py

示例3: get

# 需要导入模块: from storyengine.model.account import Account [as 别名]
# 或者: from storyengine.model.account.Account import api_login [as 别名]
	def get(self):
		REDIRECT_URL = ROOT_URL+"/login"
		args = dict(client_id=FACEBOOK_APP_ID, redirect_uri=REDIRECT_URL)
		"""redirect_url points to */login* URL of our app"""
		args["client_secret"] = FACEBOOK_APP_SECRET  #facebook APP Secret
		args["code"] = self.request.get("code")
		response = cgi.parse_qs(urllib.urlopen(
					"https://graph.facebook.com/oauth/access_token?" +
					urllib.urlencode(args)).read())
		access_token_ = response["access_token"][-1]
		profile = json.load(urllib.urlopen(
			    "https://graph.facebook.com/me?" +
			        urllib.urlencode(dict(access_token=access_token_))))
		account = Account.get_by_facebookid(profile["id"])
		if None == account:
			Account.api_login(profile['id'],
					access_token_,
					"2011-03-23 13:53:39",
					profile['name'])
			account = Account.get_by_facebookid(profile["id"])

		self.session['accountid'] = str(account.key().name()) 
		self.redirect("/")
开发者ID:zedoul,项目名称:storyengine-gae,代码行数:25,代码来源:account.py

示例4: test_account_login

# 需要导入模块: from storyengine.model.account import Account [as 别名]
# 或者: from storyengine.model.account.Account import api_login [as 别名]
def test_account_login():
	facebookid = "[email protected]"
	access_token = "access_token"
	exp_date = "2113-03-18 07:07:42"
	name = "zedoul"
	ret = Account.api_login(facebookid,access_token,exp_date,name)
	assert True == ret['success']
	assert ret['id']
	assert ret['created']
	assert ret['prices']
	assert ret['money']
	assert ret['candy']
	assert ret['storyIDs']
	assert None != ret['recommend']
	assert None != ret['score']
	assert ret['maintenance']
	assert ret['forceupdate']
	assert ret['score_expiration']
	assert 1 == ret['rank_expiration_days']
开发者ID:zedoul,项目名称:storyengine-gae,代码行数:21,代码来源:test_account.py


注:本文中的storyengine.model.account.Account.api_login方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。