def _make_flow(request, scopes, return_url=None):
 csrf_token = hashlib.sha256(os.urandom(1024)).hexdigest()
 request.session[_CSRF_KEY] = csrf_token
 state = json.dumps({'csrf_token': csrf_token, 'return_url': return_url})
 flow = client.OAuth2WebServerFlow(client_id=django_util.oauth2_settings.client_id, client_secret=django_util.oauth2_settings.client_secret, scope=scopes, state=state, redirect_uri=request.build_absolute_uri(urlresolvers.reverse('google_oauth:callback')))
 flow_key = _FLOW_KEY.format(csrf_token)
 request.session[flow_key] = jsonpickle.encode(flow)
 return flow

def _make_flow ( request , scopes , return_url = None ) : csrf_token = hashlib . sha256 ( os . urandom ( 1024 ) ) . hexdigest ( ) request . session [ _CSRF_KEY ] = csrf_token state = json . dumps ( { 'csrf_token' : csrf_token , 'return_url' : return_url } ) flow = client . OAuth2WebServerFlow ( client_id = django_util . oauth2_settings . client_id , client_secret = django_util . oauth2_settings . client_secret , scope = scopes , state = state , redirect_uri = request . build_absolute_uri ( urlresolvers . reverse ( 'google_oauth:callback' ) ) ) flow_key = _FLOW_KEY . format ( csrf_token ) request . session [ flow_key ] = jsonpickle . encode ( flow ) return flow
creates a web server flow args: request: a django request object .