From 1cf3daca635f26940644f81a131d04723f465f4e Mon Sep 17 00:00:00 2001 From: Erik Jochman <34144949+ejochman@users.noreply.github.com> Date: Thu, 7 May 2020 09:52:14 -0700 Subject: [PATCH] Add compatibility with httplib2 0.16.0+ See more at googleapis/google-api-python-client#803. Fix applied as recommended in https://github.com/googleapis/google-api-python-client/issues/803#issuecomment-578151576 --- apitools/base/py/http_wrapper.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/apitools/base/py/http_wrapper.py b/apitools/base/py/http_wrapper.py index a3fe65cb..c31bea0a 100644 --- a/apitools/base/py/http_wrapper.py +++ b/apitools/base/py/http_wrapper.py @@ -339,6 +339,10 @@ def MakeRequest(http, http_request, retries=7, max_retry_wait=60, """ retry = 0 first_req_time = time.time() + # Provide compatibility for breaking change in httplib2 0.16.0+: + # https://github.com/googleapis/google-api-python-client/issues/803 + if hasattr(http, 'redirect_codes'): + http.redirect_codes = set(http.redirect_codes) - {308} while True: try: return _MakeRequestNoRetry(