netrc#
.netrc is a file that contains login information for various servers. It’s used by programs that need to log in to servers. It’s a plain text file, and you can put your username and password in it. It’s not secure, but it’s convenient.
Netrc class#
We use the Netrc class to manage the .netrc file.
- class data_downloader.downloader.Netrc(file: str | PathLike | None = None)#
Bases:
netrca class managing records in .netrc file
- __init__(file: str | PathLike | None = None)#
- add(host, login, password, account=None, overwrite=False)#
add a record
Will do nothing if host exists in .netrc file unless set overwrite=True
- remove(host)#
remove a record by host
- clear()#
remove all records
- authenticators(host)#
Return a (user, account, password) tuple for given host.
Auxiliary functions#
- downloader.get_url_host()#
Returns the url host for a given url
- downloader.get_netrc_auth()#
Returns the Requests tuple auth for a given url from .netrc