Skip to content

Commit 09fa5a9

Browse files
authored
Expose redirect_codes on AuthorizedHttp. (#12)
Similar to #9, this exposes the `redirect_codes` attribute of the underlying httplib2.Http instance on AuthorizedHttp, letting users modify the set of HTTP status codes interpreted as redirects (as in googleapis/google-api-python-client#803).
1 parent 2d92e19 commit 09fa5a9

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

google_auth_httplib2.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,3 +260,13 @@ def timeout(self):
260260
def timeout(self, value):
261261
"""Proxy to httplib2.Http.timeout."""
262262
self.http.timeout = value
263+
264+
@property
265+
def redirect_codes(self):
266+
"""Proxy to httplib2.Http.redirect_codes."""
267+
return self.http.redirect_codes
268+
269+
@redirect_codes.setter
270+
def redirect_codes(self, value):
271+
"""Proxy to httplib2.Http.redirect_codes."""
272+
self.http.redirect_codes = value

tests/test_google_auth_httplib2.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,16 @@ def test_timeout(self):
117117
authed_http.timeout = mock.sentinel.timeout
118118
assert authed_http.http.timeout == mock.sentinel.timeout
119119

120+
def test_redirect_codes(self):
121+
authed_http = google_auth_httplib2.AuthorizedHttp(
122+
mock.sentinel.credentials
123+
)
124+
125+
assert authed_http.redirect_codes == authed_http.http.redirect_codes
126+
127+
authed_http.redirect_codes = mock.sentinel.redirect_codes
128+
assert authed_http.http.redirect_codes == mock.sentinel.redirect_codes
129+
120130
def test_add_certificate(self):
121131
authed_http = google_auth_httplib2.AuthorizedHttp(
122132
mock.sentinel.credentials,

0 commit comments

Comments
 (0)