title: how to pass authentication/credentials to the google cloud api post that I'm running from python
body: <p>I don't know how to pass authentication/credentials to the google cloud api post that I'm running from my python program</p>
  
  <pre><code>import requests
  
  api_endpoint = "https://dataflow.googleapis.com/v1b3/projects/projectid/templates"
  
  
  data = {
    "jobName": "scriptjob2",
    "parameters": {
      "inputFilePattern": "gs://bucket/files/*.json",
      "outputTopic": "projects/project6/topics/data"
    },
    "environment": {
      "tempLocation": "gs://bucket/tmp",
      "zone": "us-central1-f"
    },
    "gcsPath": "gs://dataflow-templates/latest/GCS_Text_to_Cloud_PubSub",
    "location": "us-central1"
  }
  
  r = requests.post(url = api_endpoint, data = data)
  
  result = r.text
  print("Result:%s"%result)
  </code></pre>
  
  <p>I know that I'm supposed to pass a google service account authentication but I just can't figure out how to do this. This is the error message that I'm getting. </p>
  
  <pre><code>"error": {
      "code": 401,
      "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other v
  
  alid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
      "status": "UNAUTHENTICATED"
    }
  }
  </code></pre>