def parse_entities(self, response):
"""
A table is displayed with the data about the person
who works at the Câmara
"""
mesano = response.meta['mesano']
self.log('Getting mesano: ' + mesano)
# Check if the table is empty
if not response.css('table tr td:nth-child(1)').extract_first():
return self.log('Nenhum dado disponível')
for tr in response.xpath('//table/tr').extract():
selector = Selector(text=tr)
entity_id = re.search("(javascript:pesquisa\()(\d*)(\);)", tr).group(2)
request = scrapy.FormRequest(
url=BASE_URL + 'holerite/consulta_beneficiario.html',
formdata={
'hol_ben_id': entity_id,
'hol_mesano': mesano,
'hol_tipo': '1',
'hol_grupo': GRUPO,
'acao':''
},
callback=self.parse_salaries
)
request.meta['name'] = selector.xpath("//tr/td/text()").extract_first()
request.meta['entity_id'] = entity_id
request.meta['mesano'] = mesano
yield request
holerite.py 文件源码
python
阅读 26
收藏 0
点赞 0
评论 0
评论列表
文章目录