Skip to content

Try both ~/.netrc and ~/_netrc files #186

@lovelydinosaur

Description

@lovelydinosaur

Windows uses "_netrc" rather than ".netrc".
Our implementation should simply try both.

We might want something like this...

if 'NETRC' in os.environ:
    NETRC_FILES = (os.environ['NETRC'],)
else:
    try:
        NETRC_FILES = (os.path.expanduser('~/.netrc'), os.path.expanduser('~/_netrc'))
    except KeyError:
        # May be raised if no user home directory is set.
        NETRC_FILES = ()

As part of this change we probably also want to make sure that any netrc file permission error or parse error simply results in netrc permissions not being used, rather than hard erroring.

Related to #177

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions