You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 13, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 13, 2026. It is now read-only.
the client object is initialized with no explicit _http object, and the default code path is run, creating a new requests.Session() that will be eventually GC'd but is otherwise not close()d, leading to the above warning (and a dropped connection and socket, which may have implications down the line).
Since google.core.client.Client doesn't implement e.g. the context manager protocol or close(), there's no officially sanctioned way to clean up that session; for a storage Client, I subclassed one as a workaround but it would be nice if Clients had an official close().
We've talked about a close() method for the gapic clients. Ideally the behavior will be similar in both the generated and handwritten clients. googleapis/gapic-generator-python#575
Activity
busunkim96 commentedon Dec 22, 2020
Thanks @akx!
CC @crwilcox as a
google-cloud-storageowner.We've talked about a
close()method for the gapic clients. Ideally the behavior will be similar in both the generated and handwritten clients. googleapis/gapic-generator-python#575crwilcox commentedon Dec 22, 2020
Cc @frankyn @andrewsg
tseaver commentedon Jan 13, 2021
FWIW, I'd argue that this is a feature request, rather than a bug (not that I'm opposed to adding it).
tseaver commentedon Jan 13, 2021
I'd also suggest that the existence of
contextlib.closingmakes it unnecessary to add our own__enter__/__exit__methods.feat: add 'Client.close'
feat: add 'Client.close'
feat: add 'Client.close'
feat: add 'Client.close' (#100)