def request_json(url, **kwargs):
 validator = kwargs.pop('validator', None)
 response = request_response(url, **kwargs)
 if (response is not None):
  try:
   result = response.json()
   if (validator and (not validator(result))):
    logger.error('JSON validation result failed')
   else:
    return result
  except ValueError:
   logger.error('Response returned invalid JSON data')
   if headphones.VERBOSE:
    server_message(response)

def request_json ( url , ** kwargs ) : validator = kwargs . pop ( 'validator' , None ) response = request_response ( url , ** kwargs ) if ( response is not None ) : try : result = response . json ( ) if ( validator and ( not validator ( result ) ) ) : logger . error ( 'JSON validation result failed' ) else : return result except ValueError : logger . error ( 'Response returned invalid JSON data' ) if headphones . VERBOSE : server_message ( response )
wrapper for request_response .