title: Unsure how to improve upon my error logging to help me diagnose an issue
body: <p>I have the following Python script that I'm using to attempt to create a Zendesk ticket. The following conditional statement continues to print to screen and a ticket isn't created:</p>
  
  <pre><code># Check for HTTP codes other than 201 (Created)
  if response.status_code != 201:
      print('Status:', response.status_code, 'Problem with the request. Exiting.')
      exit()
  </code></pre>
  
  <p>How can I find out more information about the error? What other details could I print to the window to help me to diagnose the issue?</p>
  
  <pre><code>import json
  import requests
  
  # New ticket info
  subject = 'My printer is on fire!'
  body = 'The smoke is very colorful.'
  
  # Package the data in a dictionary matching the expected JSON
  data = {'ticket': {'subject': subject, 'comment': {'body': body}}}
  
  # Encode the data to create a JSON payload
  payload = json.dumps(data)
  
  # Set the request parameters
  url = 'https://stackoverflow.zendesk.com/api/v2/tickets.json'
  user = 'test@stackoverflow.com'
  pwd = ''
  headers = {'content-type': 'application/json'}
  
  # Do the HTTP post request
  response = requests.post(url, data=payload, auth=(user, pwd), headers=headers)
  
  # Check for HTTP codes other than 201 (Created)
  if response.status_code != 201:
      print('Status:', response.status_code, 'Problem with the request. Exiting.')
      exit()
  </code></pre>