title: python json.load exception being passed
body: <p>sorry if this is a simple question, I am new to Python. I am trying to catch the error that my json script might not be formatted correctly. </p>
  
  <p>The code below though seems to post the request and resturns and error:</p>
  
  <pre><code>hashId = output["requestId"] # finds what the result id is
  
  KeyError: 'requestId'
  </code></pre>
  
  <p>I'm not sure why it is not printing 'JSON syntax error' and stopping there.</p>
  
  <p>Thanks</p>
  
  <pre><code>import json
  import requests
  
  
  def read_json_file(file): 
      try:
          return json.load(file)
      except ValueError:
          print('JSON syntax error')
  
  def returnRequestId(working_file, url, username, password):
      try:
          with open(working_file, 'r') as fh:  
              data = read_json_file(fh)
  
          requestpost = requests.post(url, json=data, auth=(username, password)) 
  
          output = requestpost.json() 
  
          hashId = output["requestId"] 
  
          return hashId   
  
      except ValueError:
  
          print('no request id')
  </code></pre>