def load_creds(self, creds_file=None, subdir=None, verbose=False):
        if creds_file is not None:
            self.creds_file = creds_file

        if subdir is None:
            if self.creds_subdir is None:
                msg = "Supply a value to the 'subdir' parameter or" +\
                      " set the TWITTER environment variable."
                raise ValueError(msg)
        else:
            self.creds_subdir = subdir

        self.creds_fullpath =\
            os.path.normpath(os.path.join(self.creds_subdir, self.creds_file))

        if not os.path.isfile(self.creds_fullpath):
            raise OSError('Cannot find file {}'.format(self.creds_fullpath))

        with open(self.creds_fullpath) as infile:
            if verbose:
                print('Reading credentials file {}'.format(self.creds_fullpath))

            for line in infile:
                if '=' in line:
                    name, value = line.split('=', 1)
                    self.oauth[name.strip()] = value.strip()

        self._validate_creds_file(verbose=verbose)

        return self.oauth
Read OAuth credentials from a text file.
dataset/ETHPy150Open nltk/nltk/nltk/twitter/util.py/Authenticate.load_creds