Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

GCP Resource Manager with Python for describing project to get labels value

I have to get project labels using python client and lib. Can you please let me know how to get the labels which we get using gcloud project describe 

1 1 267
1 REPLY 1

Hello @gcloudLearning ,

Here is a workaround provided by Bumeranghc:

 

gcloud projects describe <YOUR-PROJECT-NAME> --format=json | jq -r '.labels|to_entries|map("\(.key)=\(.value|tostring)")|.[]'

Before using the command, you may need to install this first:

jq