auth#

This module uses GCP’s default mechanisms to find account info. This mechanism works if the code is running on a GCP machine.

Code that runs on a GCP machine may be able to infer credentials and project_id via google.auth.default().

If the code is running on a non-GCP machine but needs to interact with GCP, you can set up environment variables to “impersonate” a GCP machine.

See: https://google.aip.dev/auth/4110

https://stackoverflow.com/questions/44328277/how-to-auth-to-google-cloud-using-service-account-in-python

cloudly.gcp.auth.get_project_id() str[source]#
cloudly.gcp.auth.get_credentials(*, valid_for_seconds: int = 600, return_state: bool = False) Credentials | tuple[Credentials, bool][source]#
valid_for_seconds: the credentials should be valid for at least this many seconds;

if the existing credential would expire sooner than this, renew it.

return_state: if True, return whether credentials have been renewed in this call;

if False, do not return this info.

cloudly.gcp.auth.get_service_account_email() str[source]#