#NEWLINE# def step1( request ) : #NEWLINE# #INDENT# constants = settings . CONSTANTS #NEWLINE# CLIENT_ID = constants [ 'CLIENT_ID' ] #NEWLINE# STEP_1_TEMPLATE_NAME = constants [ 'STEP_1_TEMPLATE_NAME' ] #NEWLINE# REDIRECT_URI = constants [ 'REDIRECT_URI' ] #NEWLINE# AUTHORIZATION_BASE_URL = constants [ 'AUTHORIZATION_BASE_URL' ] #NEWLINE# context = { #NEWLINE# #INDENT# 'initialize' : '' , #NEWLINE# #UNINDENT# } #NEWLINE# if ( request . method == 'GET' ) : #NEWLINE# #INDENT# return render ( request , STEP_1_TEMPLATE_NAME , context ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# azure_session = OAuth2Session ( CLIENT_ID , redirect_uri = REDIRECT_URI ) #NEWLINE# ( authorization_url , state ) = azure_session . authorization_url ( ( AUTHORIZATION_BASE_URL % 'common' ) ) #NEWLINE# resp = requests . get ( authorization_url ) #NEWLINE# return redirect ( resp . url )