Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion core/google/cloud/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
"for help on authentication with this library."
)

# Default timeout for auth requests.
_REFRESH_TIMEOUT = 300
Comment thread
crwilcox marked this conversation as resolved.
Outdated


class _ClientFactoryMixin(object):
"""Mixin to allow factories that create credentials.
Expand Down Expand Up @@ -153,7 +156,8 @@ def _http(self):
"""
if self._http_internal is None:
self._http_internal = google.auth.transport.requests.AuthorizedSession(
self._credentials
self._credentials,
_REFRESH_TIMEOUT,
)
return self._http_internal

Expand Down
2 changes: 1 addition & 1 deletion core/tests/unit/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def test__http_property_new(self):
with authorized_session_patch as AuthorizedSession:
self.assertIs(client._http, mock.sentinel.http)
# Check the mock.
AuthorizedSession.assert_called_once_with(credentials)
AuthorizedSession.assert_called_once_with(credentials, 300)
Comment thread
crwilcox marked this conversation as resolved.
Outdated
# Make sure the cached value is used on subsequent access.
self.assertIs(client._http_internal, mock.sentinel.http)
self.assertIs(client._http, mock.sentinel.http)
Expand Down