Skip to content

Commit 1226ee4

Browse files
committed
Bug: Catch any underlying exceptions from http.HTTPException
Resolves https://github.com/GoogleCloudPlatform/google-auth-library- python-httplib2/issues/6
1 parent 73ca3dd commit 1226ee4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

google_auth_httplib2.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from google.auth import exceptions
2222
from google.auth import transport
2323
import httplib2
24-
24+
from http.client import HTTPException
2525

2626
_LOGGER = logging.getLogger(__name__)
2727
# Properties present in file-like streams / buffers.
@@ -115,7 +115,9 @@ def __call__(self, url, method='GET', body=None, headers=None,
115115
response, data = self.http.request(
116116
url, method=method, body=body, headers=headers, **kwargs)
117117
return _Response(response, data)
118-
except httplib2.HttpLib2Error as exc:
118+
# TODO: httplib2 should catch the lower http error, this is a bug and
119+
# needs to be fixed there. Catch the error for the meanwhile.
120+
except (httplib2.HttpLib2Error, HTTPException) as exc:
119121
raise exceptions.TransportError(exc)
120122

121123

0 commit comments

Comments
 (0)