示例#1
0
def get_boss(query, start=0, count=10):
    url = get_boss_url(query, start, count)
    dom = XML(uc.get_cached_url("boss", url, pause=True))
    realstart = dom.find("resultset_web").attr("start")
    if int(realstart) == start:
        return dom.findAll("result")
    else:
        return None
示例#2
0
def get_boss(query,page=0):
	url = get_boss_url(query,page*10,10)
	dom = XML(urlopen(url))
	return dom.findAll("result")
示例#3
0
def boss_counts_for_pattern(pattern):
    """get the total number of hits for a pattern, and also download the first 50"""
    url = boss.get_boss_url(pattern, 0, 50)
    dom = XML(uc.get_cached_url("boss", url))
    hitcount = dom.find("resultset_web").attr("totalhits")
    return int(hitcount)