A web scraper build to search specific information for a given compound (and its pseudonyms)

renamed tables to table in parse()

Rob tB 429ffd74 95565042

+12 -15
+12 -15
FourmiCrawler/sources/NIST.py
··· 49 49 log.msg('NIST symbol: |%s|, name: |%s|' % (symbol, name), 50 50 level=log.DEBUG) 51 51 52 - for tables in sel.xpath('//table[@class="data"]'): 53 - if tables.xpath('@summary').extract()[0] == 'One dimensional data': 52 + for table in sel.xpath('//table[@class="data"]'): 53 + if table.xpath('@summary').extract()[0] == 'One dimensional data': 54 54 log.msg('NIST table: Aggregrate data', level=log.DEBUG) 55 55 requests.extend( 56 - self.parse_aggregate_data(tables, symbol_table)) 57 - elif tables.xpath('tr/th="Initial Phase"').extract()[0] == '1': 56 + self.parse_aggregate_data(table, symbol_table)) 57 + elif table.xpath('tr/th="Initial Phase"').extract()[0] == '1': 58 58 log.msg('NIST table; Enthalpy/entropy of phase transition', 59 59 level=log.DEBUG) 60 - requests.extend(self.parse_transition_data(tables)) 61 - elif tables.xpath('tr[1]/td'): 60 + requests.extend(self.parse_transition_data(table)) 61 + elif table.xpath('tr[1]/td'): 62 62 log.msg('NIST table: Horizontal table', level=log.DEBUG) 63 - elif (tables.xpath('@summary').extract()[0] == 63 + elif (table.xpath('@summary').extract()[0] == 64 64 'Antoine Equation Parameters'): 65 65 log.msg('NIST table: Antoine Equation Parameters', 66 66 level=log.DEBUG) 67 - requests.extend( 68 - self.parse_antoine_data(tables)) 69 - elif len(tables.xpath('tr[1]/th')) == 5: 67 + requests.extend(self.parse_antoine_data(table)) 68 + elif len(table.xpath('tr[1]/th')) == 5: 70 69 log.msg('NIST table: generic 5 columns', level=log.DEBUG) 71 70 # Symbol (unit) Temperature (K) Method Reference Comment 72 - requests.extend( 73 - self.parse_generic_data(tables)) 74 - elif len(tables.xpath('tr[1]/th')) == 4: 71 + requests.extend(self.parse_generic_data(table)) 72 + elif len(table.xpath('tr[1]/th')) == 4: 75 73 log.msg('NIST table: generic 4 columns', level=log.DEBUG) 76 74 # Symbol (unit) Temperature (K) Reference Comment 77 - requests.extend( 78 - self.parse_generic_data(tables)) 75 + requests.extend(self.parse_generic_data(table)) 79 76 else: 80 77 log.msg('NIST table: NOT SUPPORTED', level=log.WARNING) 81 78 continue #Assume unsupported