title: How to get a GCP Bearer token programmatically with python
body: <p><code>gcloud auth print-access-token</code> gives me a Bearer token that I can use later on; however, this is a shell command.  How would I obtain one programmatically via the Google Cloud Python API?  </p>
  
  <p>I see a <a href="https://stackoverflow.com/questions/46466607/how-to-obtain-a-gcp-bearer-token-programatically">prior example</a> using <a href="https://oauth2client.readthedocs.io/en/latest/" rel="noreferrer">oauth2client</a>, but <code>oauth2client</code> is now deprecated.  How would I do this with <a href="https://google-auth.readthedocs.io" rel="noreferrer">google.auth</a> and <a href="https://oauthlib.readthedocs.io/en/latest/" rel="noreferrer">oauthlib</a>?</p>