Skip to content

Commit

Permalink
Ignore PermissionError in netrc_info() (#1104)
Browse files Browse the repository at this point in the history
* Ignore PermissionError in netrc_info()
  • Loading branch information
tomchristie authored Jul 30, 2020
1 parent 31e587c commit 9728d89
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions httpx/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,13 @@ def netrc_info(self) -> typing.Optional[netrc.netrc]:
self._netrc_info = None
for file_path in self.netrc_files:
expanded_path = Path(file_path).expanduser()
if expanded_path.is_file():
self._netrc_info = netrc.netrc(str(expanded_path))
break
try:
if expanded_path.is_file():
self._netrc_info = netrc.netrc(str(expanded_path))
break
except (netrc.NetrcParseError, IOError): # pragma: nocover
# Issue while reading the netrc file, ignore...
pass
return self._netrc_info

def get_credentials(
Expand Down

0 comments on commit 9728d89

Please sign in to comment.