def get_or_create_session(): session_id = request.cookies.get('session_id') if session_id: user, _ = user_ident_from_session(session_id) if user: return session_response(session_id) return get_anonymous_session()
def process_user_stream(): ''' Retrieves User's facebook wall pictures params (GET): token: facebook token returns: success ''' token = request.args.get('token', None) if not token: return error_response(u"No TOKEN!", silent=True) print(token) user_infos = get_data_from_fql('/me', token, as_fql=False) user = get_create_user_from(user_infos.get('id'), user_type=LOGGED_IN) user = update_user_details(user, user_infos) from pprint import pprint as pp ; pp(user) execute_facebook_stream_processing.apply_async([token]) session_id = create_session(user.get('ident'), user.get('type')) return session_response(session_id)
def process_user_stream(): ''' Retrieves User's facebook wall pictures params (GET): token: facebook token returns: success ''' token = request.args.get('token', None) if not token: return error_response(u"No TOKEN!", silent=True) print(token) user_infos = get_data_from_fql('/me', token, as_fql=False) user = get_create_user_from(user_infos.get('id'), user_type=LOGGED_IN) user = update_user_details(user, user_infos) from pprint import pprint as pp pp(user) execute_facebook_stream_processing.apply_async([token]) session_id = create_session(user.get('ident'), user.get('type')) return session_response(session_id)
def get_anonymous_session(): return session_response(create_anonymous_session(request))