def get_json(environ):
 content_type = environ.get('CONTENT_TYPE', '')
 if (content_type != 'application/json'):
  raise HTTPError(406, 'JSON required')
 try:
  return json.loads(read_body(environ))
 except ValueError as exc:
  raise HTTPError(400, exc)

def get_json ( environ ) : content_type = environ . get ( 'CONTENT_TYPE' , '' ) if ( content_type != 'application/json' ) : raise HTTPError ( 406 , 'JSON required' ) try : return json . loads ( read_body ( environ ) ) except ValueError as exc : raise HTTPError ( 400 , exc )
fetch page for given url and return json python object .