Ejemplo n.º 1
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
Ejemplo n.º 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
Ejemplo n.º 3
0
def ridfill():
    req=urlopen('http://web.mit.edu/puzzle/www/2015/puzzle/rid_fill/')
    data=req.read()
    req.close()
    save_xlsx(parse_html_grid(data),'ridfill.xlsx')