Skip to content

Instantly share code, notes, and snippets.

@mesmacosta
Created October 25, 2020 18:15
Show Gist options
  • Select an option

  • Save mesmacosta/5267710d13e961b39a96f1a800bf7670 to your computer and use it in GitHub Desktop.

Select an option

Save mesmacosta/5267710d13e961b39a96f1a800bf7670 to your computer and use it in GitHub Desktop.
def _get_secrets_manager_property(property_name):
client = secretmanager.SecretManagerServiceClient()
project_id = os.environ.get('DATACATALOG_PROJECT_ID')
secret_path = client.secret_version_path(project_id, property_name, 'latest')
response = client.access_secret_version(secret_path)
return response.payload.data.decode('UTF-8')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment