From: Ben Date: Tue, 21 Feb 2012 21:53:33 +0000 (-0600) Subject: Don't bonk if .netrc isn't readable. X-Git-Tag: v0.10.5~9^2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=572c15d0494125b62ec84a670eefd3fd4615c573;p=services%2Fpython-requests.git Don't bonk if .netrc isn't readable. It's possible in some shared hosting environments that the .netrc file isn't readable by the user for the calling process. In that circumstance, just forgo the netrc authentication. --- diff --git a/requests/utils.py b/requests/utils.py index 68efa46..106c7d8 100644 --- a/requests/utils.py +++ b/requests/utils.py @@ -50,7 +50,9 @@ def get_netrc_auth(url): # Return with login / password login_i = (0 if _netrc[0] else 1) return (_netrc[login_i], _netrc[2]) - except NetrcParseError: + except NetrcParseError, IOError: + # If there was a parsing error or a permissions issue reading the file, + # we'll just skip netrc auth pass