#NEWLINE# def update_with( self , name , security_info ) : #NEWLINE# #INDENT# ' insert/clear authorizations\n\n        :param str name: name of the security info to be updated\n        :param security_info: the real security data, token, ...etc.\n        :type security_info: **(username, password)** for *basicAuth*, **token** in str for *oauth2*, *apiKey*.\n\n        :raises ValueError: unsupported types of authorizations\n        ' #NEWLINE# s = self . __app . root . securityDefinitions . get ( name , None ) #NEWLINE# if ( s == None ) : #NEWLINE# #INDENT# raise ValueError ( 'Unknown security name: [{0}]' . format ( name ) ) #NEWLINE# #UNINDENT# cred = security_info #NEWLINE# header = True #NEWLINE# if ( s . type == 'basic' ) : #NEWLINE# #INDENT# cred = ( 'Basic ' + base64 . standard_b64encode ( six . b ( '{0}:{1}' . format ( * security_info ) ) ) . decode ( 'utf-8' ) ) #NEWLINE# key = 'Authorization' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( s . type == 'apiKey' ) : #NEWLINE# #INDENT# key = s . name #NEWLINE# header = ( getattr ( s , 'in' ) == 'header' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( s . type == 'oauth2' ) : #NEWLINE# #INDENT# key = 'access_token' #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( 'Unsupported Authorization type: [{0}, {1}]' . format ( name , s . type ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# self . __info . update ( { #NEWLINE# #INDENT# name : ( header , { #NEWLINE# #INDENT# key : cred , #NEWLINE# #UNINDENT# } ) , #NEWLINE# #UNINDENT# } )