def parse_input(raw_data):
 try:
  parsed_data = json.loads(raw_data)
 except ValueError:
  raise HTTPBadRequest('Manifest must be valid json.')
 req_keys = set(['path', 'etag', 'size_bytes'])
 try:
  for seg_dict in parsed_data:
   if ((set(seg_dict.keys()) != req_keys) or ('/' not in seg_dict['path'].lstrip('/'))):
    raise HTTPBadRequest('Invalid SLO Manifest File')
 except (AttributeError, TypeError):
  raise HTTPBadRequest('Invalid SLO Manifest File')
 return parsed_data

def parse_input ( raw_data ) : try : parsed_data = json . loads ( raw_data ) except ValueError : raise HTTPBadRequest ( 'Manifest must be valid json.' ) req_keys = set ( [ 'path' , 'etag' , 'size_bytes' ] ) try : for seg_dict in parsed_data : if ( ( set ( seg_dict . keys ( ) ) != req_keys ) or ( '/' not in seg_dict [ 'path' ] . lstrip ( '/' ) ) ) : raise HTTPBadRequest ( 'Invalid SLO Manifest File' ) except ( AttributeError , TypeError ) : raise HTTPBadRequest ( 'Invalid SLO Manifest File' ) return parsed_data
given a request will parse the body and return a list of dictionaries :raises: httpexception on parse errors :returns: a list of dictionaries on success .