Esempio n. 1
0
def index():
	try:
		user_list = facebook.do_fql_request(session['access_token'])
		you = facebook.get_user_book(session['access_token'])

		r = recommend.Recommend()
		r.build_dict(user_list, you)
		recommendations = r.compare()
		recommended = []
		for book in recommendations:
			b =  bookinfo.get(book)
			if b is not None: 
				recommended.append(b)
		return render_template("/index.html", recommended = recommended)
	except KeyError:
		return render_template("/auth.html", auth_str = fb.auth_string)
Esempio n. 2
0
def index(**k):
	fb_auth = oauth2.FacebookAuth(FACEBOOK_ID, FACEBOOK_SECRET, "http://0.0.0.0:8080/callback")
	if k['access_token'] == "undefined":
		return render.auth(auth=fb_auth.auth_string)
	else:
		session = k['session']
		user_list = facebook.do_fql_request(session.access_token)

		you = facebook.get_user_book(session.access_token)
		


		r = recommend.Recommend()
		r.build_dict(user_list, you)
		recommendations = r.compare()
		recommended = []
		for book in recommendations:
			b =  bookinfo.get(book)
			if b is not None: 
				recommended.append(b)

		return render.index(recommended=recommended)