#NEWLINE# @ property #NEWLINE# def token( self ) : #NEWLINE# #INDENT# '\n        set the instance attribute `token` following the following logic,\n        stopping whenever a token is found. Raises NoTokenFound is no token\n        is found\n        - environment variables TOKEN_ENVIRON_VARS\n        - file containing plaintext as the contents in TOKEN_FILES\n        - ads.config.token\n        ' #NEWLINE# if ( self . _token is None ) : #NEWLINE# #INDENT# for v in map ( os . environ . get , TOKEN_ENVIRON_VARS ) : #NEWLINE# #INDENT# if ( v is not None ) : #NEWLINE# #INDENT# self . _token = v #NEWLINE# return self . _token #NEWLINE# #UNINDENT# #UNINDENT# for f in TOKEN_FILES : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# with open ( f ) as fp : #NEWLINE# #INDENT# self . _token = fp . read ( ) . strip ( ) #NEWLINE# return self . _token #NEWLINE# #UNINDENT# #UNINDENT# except IOError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# if ( ads . config . token is not None ) : #NEWLINE# #INDENT# self . _token = ads . config . token #NEWLINE# return self . _token #NEWLINE# #UNINDENT# warnings . warn ( 'No token found' , RuntimeWarning ) #NEWLINE# #UNINDENT# return self . _token