From ca36c22d7455ad05d36f06584e3f62dc8169f8aa Mon Sep 17 00:00:00 2001 From: Marcelo Andriolli Date: Sat, 19 May 2018 15:17:16 -0300 Subject: [PATCH] {WIP} Get header from each auctiations #3 --- comprasnet/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/comprasnet/__init__.py b/comprasnet/__init__.py index fcafa3a..c717411 100644 --- a/comprasnet/__init__.py +++ b/comprasnet/__init__.py @@ -76,11 +76,15 @@ def get_data_auctions_pages(self, data): current_result['cidade'] = cidade current_result['uf'] = uf + headers = [element for element in td.b.contents + if 'Código da UASG' not in element] + headers = [element.strip() for element in headers + if isinstance(element, str)] + current_result['cabecalho'] = headers for line in str(td).split("
"): if 'digo da UASG' in line: - try: current_result['cabecalho'] = header codigo_da_uasg_chave = line.split(":")[0]