netrc.netrc()
netrc.netrc() is a Python function in the Netrc Module category. Parses the .netrc file for login credentials (host, login, password). The syntax is netrc.netrc(file=None). Returns: Netrc object. A typical example: import netrc
n = netrc.netrc()
login, acct, password = n.authenticators("github.com")
print(login, password) # Login credentials for github.com. A close sibling is netrc.authenticators(), which returns (login, account, password) tuple for a given host from .netrc. More about this category: .netrc file parser — netrc, authenticators, hosts. Related Netrc Module entries: netrc.authenticators(). This page is part of the free Python Reference documentation covering 978+ functions, methods, and modules with examples and parameter details. You can try netrc.netrc() immediately in the Python playground, look up unfamiliar terms in the glossary, or return to the Python Reference homepage.