def loadPurchase(self, pageNumber): ParserBase.__init__(self, 'purchaseMethod', "p=true&d-4031123-p=%i" % pageNumber) skipValue = u"Все способы" contenttable = self.soup.find('table', {'class': 'maintable', 'id': 'resultTable'}) for method in (val.text.strip().lower() \ for val in contenttable.findAll('td', {'class': 'purchaseValue'}) \ if val.text.find(skipValue) == -1): yield method
def __init__(self, purchaseParams): ParserBase.__init__(self, 'purchase', purchaseParams) self.purchaseID = 0 for purchaseParam in purchaseParams.split("&"): try: key, val = purchaseParam.split("=")[:2] if key == "purchaseId": self.purchaseID = int(val) break except: pass
def __init__(self, protocolParams): ParserBase.__init__(self, 'viewProtocols', protocolParams) self.protocolInfoID = 0 for protocolParam in protocolParams.split("&"): try: key, val = protocolParam.split("=")[:2] if key == "protocolInfoId": self.protocolInfoID = int(val) break except ValueError: pass
def allEntriesForPage(self, pageNumber): ParserBase.__init__(self, 'organizationSearchForm', "d-442831-p=%i" % pageNumber) contenttable = self.soup.find('table', {'class': 'maintable', 'id':'agency'}) headers = [th.text.strip() for th in contenttable.thead.tr.findAll('th') if th.text.strip() != ""] headers.append('URL') url = '' for tr in contenttable.tbody.findAll('tr'): values = [] tds = tr.findAll('td') for td in tds: values.append(td.text.strip().replace('\"', '')) url = tds[0].find('a')['onclick'].strip() url = url[url.index('\'') + 1: url.rindex('\'')] values.append(url) resDict = dict(zip(headers, values)) yield resDict pass
def __init__(self): ParserBase.__init__(self, 'searchForm', "d-3771889-p=%i&purchaseStages=%s" % (1, "APPLICATION_FILING")) self.searchUrl = "%s%s?%s" % (globals.urlBase, globals.urlPaths['searchForm'], "d-3771889-p=%i&purchaseStages=%s")
def __init__(self): ParserBase.__init__(self, 'organizationSearchForm', "d-442831-p=%i" % 1) self.searchUrl = "%s%s?%s" % (globals.urlBase, globals.urlPaths['organizationSearchForm'], "d-442831-p=%i")