Class Client (2.5.0) Stay organized with collections Save and categorize content based on your preferences.
Client(credentials=None,_http=None,client_options=None)Client to bundle configuration needed for API requests.
Storescredentials and an HTTP object so that subclassescan pass them along to a connection class.
If no value is passed in for_http, arequests.Session objectwill be created and authorized with thecredentials. If not, thecredentials and_http need not be related.
Callers and subclasses may seek to use the private key fromcredentials to sign data.
Parameters | |
|---|---|
| Name | Description |
credentials | google.auth.credentials.Credentials(Optional) The OAuth2 Credentials to use for this client. If not passed (and if no |
client_options | google.api_core.client_options.ClientOptions(Optional) Custom options for the client. |
_http | requests.Session(Optional) HTTP object to make requests. Can be any object that defines |
Methods
__getstate__
__getstate__()Explicitly state that clients are not pickleable.
close
close()Clean up transport, if set.
Suggested use:
import contextlibwith contextlib.closing(client): # closes on exit do_something_with(client)Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-10-30 UTC.