title: Calling Cloud Function from App Engine runtime Python 3.7
body: <p>I have an App Engine service, running Python 3.7, that needs to call and get a response from one of my Cloud Functions via the <code>https.oncall</code> trigger.</p>
  
  <p>I thought I could do so with the following:</p>
  
  <pre><code>import logging
  from sys import exit
  
  import firebase_admin
  
  import requests
  
  import google.cloud.logging
  client = google.cloud.logging.Client()
  client.setup_logging()
  
  firebase_admin.initialize_app()
  
  response = requests.post("https://us-central1-myproject.cloudfunctions.net/functionname", data={"foo": "bar"})
  
  if response.status_code != 200:
      exit("Could not call function! :(") # This is happening
  
  logging.info(f"Yay! Here is the result: {response.text}")
  
  # do something else
  
  exit()
  </code></pre>
  
  <p>However, I'm getting <code>Request has incorrect Content-Type.</code> from Cloud Functions.</p>
  
  <p>I've tried multiple variations on the request syntax such as: <code>data='{"foo": "bar"}'</code> and <code>data=json.dumps({"foo": "bar"})</code> but all I can get back is either <code>Request has incorrect Content-Type.</code> or <code>Request has incorrect Content-Type. application/x-www-form-urlencoded</code>.</p>
  
  <p>How do I properly attach my dictionary to my request so that the function receives it in the form of <code>application/json</code> as noted <a href="https://firebase.google.com/docs/functions/callable-reference" rel="nofollow noreferrer">in the Cloud Function docs</a>?</p>
  
  <p>I've read other posts that suggest using the <code>json.dumps()</code> function will tell <code>request</code> to use <code>application/json</code> but Cloud Functions wasn't happy about it.</p>