Skip to content
Myr

Merge pull request #2656 from dpursehouse/get_netrc_auth_errors

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Allow get_netrc_auth to raise parse/permission errors to caller

authored by Cory Benfield · committed by Cory Benfield · parents f5dacf8, 884cb7a · Browse files · 1 file+4 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+4 added−3 removed

  • other:+4 added−3 removed

1 file+4 added−3 removed

modified:requests/utils.py+4 added-3 removed
65 unmodified lines
66 # e.g. BytesIO, cStringIO.StringIO67 return len(o.getvalue())686970def get_netrc_auth(url):70def get_netrc_auth(url, raise_errors=False):71 """Returns the Requests tuple auth for a given url from netrc."""7273 try:74 from netrc import netrc, NetrcParseError
29 unmodified lines
104 login_i = (0 if _netrc[0] else 1)105 return (_netrc[login_i], _netrc[2])106 except (NetrcParseError, IOError):107 # If there was a parsing error or a permissions issue reading the file,108 # we'll just skip netrc auth109 pass108 # we'll just skip netrc auth unless explicitly asked to raise errors.109 if raise_errors:110 raise111112 # AppEngine hackiness.113 except (ImportError, AttributeError):114 pass
594 unmodified lines