| 415 | FieldClass = Field |
| 416 | |
| 417 | def __init__(self, response, text, parser_features='html.parser'): |
| 418 | self.response = response |
| 419 | self.text = text |
| 420 | self.html = BeautifulSoup(self.text, parser_features) |
| 421 | |
| 422 | attrs = self.html('form')[0].attrs |
| 423 | self.action = attrs.get('action', '') |
| 424 | self.method = attrs.get('method', 'GET') |
| 425 | self.id = attrs.get('id') |
| 426 | self.enctype = attrs.get('enctype', |
| 427 | 'application/x-www-form-urlencoded') |
| 428 | |
| 429 | self._parse_fields() |
| 430 | |
| 431 | def _parse_fields(self): |
| 432 | fields = OrderedDict() |