Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions contra/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,18 @@ def extract_name(td_tag):
return {"name": name, "url" : url, "description": description, "publication_date": publication_date}
return None

def extract_contractor(self):
matches = CSSSelector(".subtitulos a")(self.parsed_content)
contractor = ""
for match in matches:
contractor = match.text.strip()

return contractor

def parse(self):
contract_representation = dict()
contract_representation['documents'] = list()
contract_representation['contratante'] = self.extract_contractor()

tr_tags = CSSSelector("tr")(self.parsed_content)
for tr_tag in tr_tags:
Expand All @@ -78,6 +85,7 @@ def parse(self):
document = self.extract_doc(td_tags)
if document:
contract_representation['documents'].append(document)

return contract_representation

def parse_contract_page(page_file):
Expand Down