예제 #1
0
파일: unnim.py 프로젝트: josepanguera/unnim
def printlastmovements(num, html):
    print '\n\nNúmero de compte: "%s"\n' % num
    soup = BeautifulSoup(html, convertEntities=BeautifulSoup.HTML_ENTITIES)
    table = soup.find('table', {'class': 'sortable'})
    rows = []
    for tr in table.findAll('tr'):
        row = []
        for x in tr.findAll(['th', 'td']):
            text = x.text.encode('utf8').strip()
            row.append(text)
        rows.append(row)
    print indent(rows, True)
예제 #2
0
파일: unnim.py 프로젝트: josepanguera/unnim
def printlastmovements(num, html):
    print '\n\nNúmero de compte: "%s"\n' % num
    soup = BeautifulSoup(html, convertEntities=BeautifulSoup.HTML_ENTITIES)
    table = soup.find('table', {'class': 'sortable'})
    rows = []
    for tr in table.findAll('tr'):
        row = []
        for x in tr.findAll(['th', 'td']):
            text = x.text.encode('utf8').strip()
            row.append(text)
        rows.append(row)
    print indent(rows, True)
예제 #3
0
파일: driver.py 프로젝트: dcolish/fusionsql
    def parse(self, response, pprint):
        try:

            if pprint:
                reader = csv.reader(response)
                return indent([x for x in reader], hasHeader=True)
            else:
                return csv.DictReader(response)
        except Exception, e:
            print e
            raise Exception(e)
예제 #4
0
파일: unnim.py 프로젝트: josepanguera/unnim
def posicioglobal(html):
    soup = BeautifulSoup(html, convertEntities=BeautifulSoup.HTML_ENTITIES)
    accountnums = []
    for table in soup.findAll('table', {'class': 'TaulaPosGlb'}):
        print table.caption.span.text.strip().encode('utf8')
        print
        rows = []
        for tr in table.findAll('tr'):
            row = []
            for i, x in enumerate(tr.findAll(['th', 'td'])):
                text = x.text.encode('utf8').strip()
                if i != 3:
                    row.append(text)
                else:
                    # Extract account numbers
                    if re.search(r'expandeix.+LLI', text):
                        m = re.search(r'\((.+)\)', text)
                        accountnums.append(m.group(0).strip().strip('()').split(',')[0].strip().strip('\''))
            rows.append(row)
        print indent(rows, True)
        print
    return accountnums
예제 #5
0
파일: unnim.py 프로젝트: josepanguera/unnim
def posicioglobal(html):
    soup = BeautifulSoup(html, convertEntities=BeautifulSoup.HTML_ENTITIES)
    accountnums = []
    for table in soup.findAll('table', {'class': 'TaulaPosGlb'}):
        print table.caption.span.text.strip().encode('utf8')
        print
        rows = []
        for tr in table.findAll('tr'):
            row = []
            for i, x in enumerate(tr.findAll(['th', 'td'])):
                text = x.text.encode('utf8').strip()
                if i != 3:
                    row.append(text)
                else:
                    # Extract account numbers
                    if re.search(r'expandeix.+LLI', text):
                        m = re.search(r'\((.+)\)', text)
                        accountnums.append(
                            m.group(0).strip().strip('()').split(',')
                            [0].strip().strip('\''))
            rows.append(row)
        print indent(rows, True)
        print
    return accountnums