Exemple #1
0
def fill_in_the_blanks():
    req=urlopen('http://web.mit.edu/puzzle/www/2013/coinheist.com/get_smart/fill_in_the_blanks/index.html')
    data=req.read().decode()
    req.close()
    tables = data.split('</table>')
    grids=[parse_html_table(t,styleattr='class',styledict={'b':0}) for t in tables]
    to_openpyxl_multi(grids[:-1]).save('fill_in_the_blanks.xlsx')
Exemple #2
0
def read_html(data,args):
    try:
        data=data.decode()
    except UnicodeDecodeError:
        raise NotRecognized
    if '<div class="bk"' in data:
        return parse_html_grid(data)
    elif '<table' in data:
        if not args.color_attribute:
            raise NotRecognized('HTML contains a table, but --color-attribute not specified.  Try specifying --color-attribute and --color-value-dark.')
        return parse_html_table(data,styleattr=args.color_attribute,styledict={args.color_value_dark:0})
    else:
        raise NotRecognized
Exemple #3
0
def read_html(data, args):
    try:
        data = data.decode()
    except UnicodeDecodeError:
        raise NotRecognized
    if '<div class="bk"' in data:
        return parse_html_grid(data)
    elif '<table' in data:
        if not args.color_attribute:
            raise NotRecognized(
                'HTML contains a table, but --color-attribute not specified.  Try specifying --color-attribute and --color-value-dark.'
            )
        return parse_html_table(data,
                                styleattr=args.color_attribute,
                                styledict={args.color_value_dark: 0})
    else:
        raise NotRecognized