fix: don't set http.redirect_codes if the attr doesn't exist and allow more httplib2 versions (#841)
* fix: don't set http.redirect_codes if the attr doesn't exist
* fix: widen permitted httplib2 versions
diff --git a/googleapiclient/http.py b/googleapiclient/http.py
index 719664d..cf9a509 100644
--- a/googleapiclient/http.py
+++ b/googleapiclient/http.py
@@ -1891,6 +1891,13 @@
# for Resumable Uploads rather than Permanent Redirects.
# This asks httplib2 to exclude 308s from the status codes
# it treats as redirects
- http.redirect_codes = http.redirect_codes - {308}
+ try:
+ http.redirect_codes = http.redirect_codes - {308}
+ except AttributeError:
+ # Apache Beam tests depend on this library and cannot
+ # currently upgrade their httplib2 version
+ # http.redirect_codes does not exist in previous versions
+ # of httplib2, so pass
+ pass
return http