Edgewall Software

Ticket #375: test_view.py

File test_view.py, 438 bytes (added by anatoly techtonik <techtonik@…>, 4 years ago)
Line 
1
2import genshi
3import urllib2
4
5def genshi_parse(url):
6    """parse url to get bug title"""
7    title_path = "head/title/text()"
8    mbt_file = urllib2.urlopen(url)
9    #mbt_genshi = genshi.input.HTML(mbt_file)
10    mbt_genshi = genshi.input.HTMLParser(mbt_file)
11    title = mbt_genshi.parse().select(title_path)#.render().decode("utf-8")
12    #except genshi.ParseError:
13    #    pass
14    return title
15
16print genshi_parse("file:./view.php")