def _parse_response(header_data, ignore_bad_cookies=False, ignore_bad_attributes=True):
 cookie_dicts = []
 for line in Definitions.EOL.split(header_data.strip()):
  if (not line):
   break
  cookie_dict = parse_one_response(line, ignore_bad_cookies=ignore_bad_cookies, ignore_bad_attributes=ignore_bad_attributes)
  if (not cookie_dict):
   continue
  cookie_dicts.append(cookie_dict)
 if (not cookie_dicts):
  if (not ignore_bad_cookies):
   raise InvalidCookieError(data=header_data)
  _report_invalid_cookie(header_data)
 return cookie_dicts

def _parse_response ( header_data , ignore_bad_cookies = False , ignore_bad_attributes = True ) : cookie_dicts = [ ] for line in Definitions . EOL . split ( header_data . strip ( ) ) : if ( not line ) : break cookie_dict = parse_one_response ( line , ignore_bad_cookies = ignore_bad_cookies , ignore_bad_attributes = ignore_bad_attributes ) if ( not cookie_dict ) : continue cookie_dicts . append ( cookie_dict ) if ( not cookie_dicts ) : if ( not ignore_bad_cookies ) : raise InvalidCookieError ( data = header_data ) _report_invalid_cookie ( header_data ) return cookie_dicts
turn one or more lines of set-cookie: header data into a list of dicts mapping attribute names to attribute values .