From: Tom Christie Date: Thu, 30 Jul 2020 14:40:13 +0000 (+0100) Subject: Ignore PermissionError in netrc_info() (#1104) X-Git-Tag: 0.14.0~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9728d8960f1b10502365cbdb414c16442fca7d05;p=thirdparty%2Fhttpx.git Ignore PermissionError in netrc_info() (#1104) * Ignore PermissionError in netrc_info() --- diff --git a/httpx/_utils.py b/httpx/_utils.py index 55503655..f01cfe4e 100644 --- a/httpx/_utils.py +++ b/httpx/_utils.py @@ -139,9 +139,13 @@ class NetRCInfo: 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(