(self)
return None
Try to read the API key from a series of files if it's not provided in code
Try to read the API key from a series of files if it's not provided in code
Try to read the API key from a series of files if it s not provided in code
def read_configs(self):
        '''Try to read the API key from a series of files if it's not provided in code'''
        paths = [os.path.expanduser('~/.mandrill.key'), '/etc/mandrill.key']
        for path in paths:
            try:
                f = open(path, 'r')
                apikey = f.read().strip()
                f.close()
                if apikey != '':
                    return apikey
            except:
                pass

        return None
def read_configs ( self ) : paths = [ os . path . expanduser ( '~/.mandrill.key' ) , '/etc/mandrill.key' ] for path in paths : try : f = open ( path , 'r' ) apikey = f . read ( ) . strip ( ) f . close ( ) if apikey != '' : return apikey except : pass return None