title: error while calling google api from python command line
body: <p>I am very new to python. I am trying to call google monitoring API, through python command line from <strong>google cloud shell</strong>. I am using python 2.7. Before that I had already installed</p>
  <pre><code>pip install --upgrade google-api-python-client    
  </code></pre>
  <p>This is the code for calling google monitoring api</p>
  <pre><code>from googleapiclient.discovery import build
  
  service = build('monitoring', 'v3', cache_discovery=True)
  timeseries = service.projects().timeSeries().list(
              name=&quot;my-project&quot;,
              filter=&quot;metric.type=compute.googleapis.com/instance/cpu/utilization&quot;
              aggregation_alignmentPeriod=86400s,
              # aggregation_crossSeriesReducer=api_args[&quot;crossSeriesReducer&quot;],
              aggregation_perSeriesAligner=&quot;ALIGN_MEAN&quot;,
              aggregation_groupByFields=&quot;metric.labels.key&quot;,
              interval_endTime=&quot;2020-08-23T17:30:04.707Z&quot;,
              interval_startTime=&quot;2020-08-22T17:30:05.603000Z&quot;,
              pageSize=100
          ).execute()
  </code></pre>
  <p>I pass the appropriate values in python command line and when I execute this line</p>
  <pre><code>service = build('monitoring', 'v3', cache_discovery=True)
  </code></pre>
  <p>i get the following error:</p>
  <pre><code>&gt;&gt;&gt;from googleapiclient.discovery import build
  &gt;&gt;&gt; service = build('monitoring', 'v3', cache_discovery=True)
  Traceback (most recent call last):
    File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
    File &quot;/home/mugham/.local/lib/python2.7/site-packages/googleapiclient/_helpers.py&quot;, line 134, in positional_wrapper
      return wrapped(*args, **kwargs)
    File &quot;/home/mugham/.local/lib/python2.7/site-packages/googleapiclient/discovery.py&quot;, line 282, in build
      adc_key_path=adc_key_path,
    File &quot;/home/mugham/.local/lib/python2.7/site-packages/googleapiclient/_helpers.py&quot;, line 134, in positional_wrapper
      return wrapped(*args, **kwargs)
    File &quot;/home/mugham/.local/lib/python2.7/site-packages/googleapiclient/discovery.py&quot;, line 489, in build_from_document
      credentials = _auth.default_credentials()
    File &quot;/home/mugham/.local/lib/python2.7/site-packages/googleapiclient/_auth.py&quot;, line 44, in default_credentials
      credentials, _ = google.auth.default()
    File &quot;/usr/local/lib/python2.7/dist-packages/google/auth/_default.py&quot;, line 338, in default
      credentials, project_id = checker()
    File &quot;/usr/local/lib/python2.7/dist-packages/google/auth/_default.py&quot;, line 208, in _get_gae_credentials
      project_id = app_engine.get_project_id()
    File &quot;/usr/local/lib/python2.7/dist-packages/google/auth/app_engine.py&quot;, line 77, in get_project_id
      return app_identity.get_application_id()
    File &quot;/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/api/app_identity/app_identity.py&quot;, line 455, in get_application_id
      _, domain_name, display_app_id = _ParseFullAppId(full_app_id)
    File &quot;/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/api/app_identity/app_identity.py&quot;, line 436, in _ParseFullAppId
      psep = app_id.find(_PARTITION_SEPARATOR)
  AttributeError: 'NoneType' object has no attribute 'find'
  </code></pre>
  <p>I have no idea why this is coming, Can anyone please help me? Thanks</p>