code: def _parse_response(response, post_request=False):
          
          try:
              data = response.json()
          except:
              msg = 'Unhandled HTTP %s response, shown truncated below:\n%s...' % (
                  response.status_code, response.text[:50]
              )
              raise ValueError(msg)
  
          if not response.ok:
              utils.error_message_and_exit(None, data)
  
          if post_request and not data['success']:
              raise Exception('Asmaster Api Error: [%s]' % data['error'])
  
          return data
docs: Treat the response from ASApi.
  
          The json is dumped before checking the status as even if the response is
          not properly formed we are in trouble.