def start_association(user): """Uses the API to start a new association session, and stores it.""" service = api_utils.initialize_service() result = service.associationsessions().start( productCode='AFC', websiteUrl='www.examplehost.com/blog/%s' % user.name).execute() session = AssociationSession(session_id=result['id'], user=user, redirect_url=result['redirectUrl']) session.save() return session
def start_association(user): """Uses the API to start a new association session, and stores it.""" service = api_utils.initialize_service() result = service.associationsessions().start( productCode='AFC', websiteUrl='www.examplehost.com/blog/%s' % user.name ).execute() session = AssociationSession( session_id=result['id'], user=user, redirect_url=result['redirectUrl']) session.save() return session
def callback(request): """Ephemeral view that handles the callback at the end of signup.""" service = api_utils.initialize_service() return handle_callback(service, request)
def verify_association(token): """Uses the API to verify an association session token.""" service = api_utils.initialize_service() result = service.associationsessions().verify(token=token).execute() return result