Skip to content

Commit e7cd722

Browse files
PooglesJon Wayne Parrott
authored andcommitted
Bug: Catch any underlying exceptions from http.HTTPException (#7)
* Bug: Catch any underlying exceptions from http.HTTPException Resolves https://github.com/GoogleCloudPlatform/google-auth-library- python-httplib2/issues/6 * PR: Fix build. * Remove unneeded comment.
1 parent 73ca3dd commit e7cd722

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

google_auth_httplib2.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from google.auth import exceptions
2222
from google.auth import transport
2323
import httplib2
24+
from six.moves import http_client
2425

2526

2627
_LOGGER = logging.getLogger(__name__)
@@ -115,7 +116,9 @@ def __call__(self, url, method='GET', body=None, headers=None,
115116
response, data = self.http.request(
116117
url, method=method, body=body, headers=headers, **kwargs)
117118
return _Response(response, data)
118-
except httplib2.HttpLib2Error as exc:
119+
# httplib2 should catch the lower http error, this is a bug and
120+
# needs to be fixed there. Catch the error for the meanwhile.
121+
except (httplib2.HttpLib2Error, http_client.HTTPException) as exc:
119122
raise exceptions.TransportError(exc)
120123

121124

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
DEPENDENCIES = (
2121
'google-auth',
2222
'httplib2 >= 0.9.1',
23+
'six'
2324
)
2425

2526

0 commit comments

Comments
 (0)