Exemplo n.º 1
0
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)
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
    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)
Exemplo n.º 4
0
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
Exemplo n.º 5
0
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