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

included summary variable in call to transition_table, antoine table and generic table

Rob tB 6cd8edaf c0af2464

+8 -8
+8 -8
FourmiCrawler/sources/NIST.py
··· 58 58 elif table.xpath('tr/th="Initial Phase"').extract()[0] == '1': 59 59 log.msg('NIST table; Enthalpy/entropy of phase transition', 60 60 level=log.DEBUG) 61 - requests.extend(self.parse_transition_data(table)) 61 + requests.extend(self.parse_transition_data(table, summary)) 62 62 elif table.xpath('tr[1]/td'): 63 63 log.msg('NIST table: Horizontal table', level=log.DEBUG) 64 - elif summary == 'Antoine Equation Parameters'): 64 + elif summary == 'Antoine Equation Parameters': 65 65 log.msg('NIST table: Antoine Equation Parameters', 66 66 level=log.DEBUG) 67 - requests.extend(self.parse_antoine_data(table)) 67 + requests.extend(self.parse_antoine_data(table, summary)) 68 68 elif len(table.xpath('tr[1]/th')) == 5: 69 69 log.msg('NIST table: generic 5 columns', level=log.DEBUG) 70 70 # Symbol (unit) Temperature (K) Method Reference Comment 71 - requests.extend(self.parse_generic_data(table)) 71 + requests.extend(self.parse_generic_data(table, summary)) 72 72 elif len(table.xpath('tr[1]/th')) == 4: 73 73 log.msg('NIST table: generic 4 columns', level=log.DEBUG) 74 74 # Symbol (unit) Temperature (K) Reference Comment 75 - requests.extend(self.parse_generic_data(table)) 75 + requests.extend(self.parse_generic_data(table, summary)) 76 76 else: 77 77 log.msg('NIST table: NOT SUPPORTED', level=log.WARNING) 78 78 continue #Assume unsupported ··· 159 159 return results 160 160 161 161 @staticmethod 162 - def parse_transition_data(table): 162 + def parse_transition_data(table, summary): 163 163 """Parses the table containing properties regarding phase changes""" 164 164 results = [] 165 165 ··· 185 185 return results 186 186 187 187 @staticmethod 188 - def parse_generic_data(table): 188 + def parse_generic_data(table, summary): 189 189 """Parses the common tables of 4 and 5 rows. Assumes they are of the 190 190 form: 191 191 Symbol (unit)|Temperature (K)|Method|Reference|Comment ··· 213 213 return results 214 214 215 215 @staticmethod 216 - def parse_antoine_data(table): 216 + def parse_antoine_data(table, summary): 217 217 """Parse table containing parameters for the Antione equation""" 218 218 results = [] 219 219