Maintains contextual state for connecting to Cloud APIs.
Initializes an instance of a Context object.
- project_id – the current cloud project.
- credentials – the credentials to use to authorize requests.
Retrieves the value of the credentials property.
Returns: The current credentials used in authorizing API requests.
Retrieves a default Context object, creating it if necessary.
The default Context is a global shared instance used every time the default context is retrieved.
Attempting to use a Context with no project_id will raise an exception, so on first use set_project_id must be called.
Returns: An initialized and shared instance of a Context object.
If the user has signed in or it is on GCE VM with default credential.
Retrieves the value of the project_id property.
Returns: The current project id to associate with API requests.
Set the credentials for the context.
Set the project_id for the context.
Project(api, id, number, name)¶
Simple wrapper class for Cloud projects.
Iterator class for enumerating the active projects accessible to the account.
Initialize the Projects object.
Parameters: credentials – the credentials for the account.
Get default project id.
Returns: the default project id if there is one, or None.
Save default project id to config so it will persist across kernels and Datalab runs.
Parameters: project_id – the project_id to save.