Beispiel #1
0
def test_case_a(data,c):
    keywordvlue = "destination"
    #keywordvlue = "CompanyList"
    #keywordvlue = "FeatureList"
    table = data.sheet_by_name('url')
    urlhttp = table.cell(1, read_excel.find_colum(file,'url','url')).value+"action=autocomplete&source=globalapp64&lon=121.35801673&lat=31.22016018&districtid=2"+"&keyword="+keyword
    for row_date in range(1, read_excel.rownum(file,'insurance')):
        table = data.sheet_by_name('insurance')
        bb = table.cell(row_date, read_excel.find_colum(file,'insurance',keywordvlue)).value
        reload(sys)
        sys.setdefaultencoding('utf-8')
        bb = str(bb)
        aa = urllib.quote(bb)
        urldate = urlhttp+aa+urllib.quote("保险")
        lennum = http.lendate(urldate)
        errcode = http.head(urldate,"errcode")
        word = http.get_key_vlue(urldate,0,"word")
        type = http.get_key_vlue(urldate,0,"type")
        urlt = http.get_key_vlue(urldate,0,"url")
        count = urlt.count(keywordvlue)
        #print lennum,word,bb+"保险",errcode,type,count
        if lennum == 1 and word == bb+"保险" and errcode ==0 and type == "insurance" and count==1:
            print word,urlt
            #print urldate
        else:
            print word,urlt
Beispiel #2
0
def start():
    row_date = 1
    andf = 1
    fromt = 1
    andm = 1
    tot =1
    bb = ''

    file = 'D:\work\code\ctriptest\datebase1.xls'
    data = read_excel.open_excel(file)
    table = data.sheet_by_name('type')
    typelist = []
    for row_date in range(1, read_excel.rownum(file,'type')):
        bb = table.cell(row_date, read_excel.find_colum(file,'type','keyword')).value
        #bb = 'shanghai'
        reload(sys)
        sys.setdefaultencoding('utf-8')
        bb = str(bb)
        #time.sleep(2)
        aa = urllib.quote(bb)
        url = 'http://10.2.25.24:8180/appautocomplete/search?keyword='+aa+'&action=autocomplete&source=globalapp63&lon=121.35801673&lat=31.22016018&districtid=2'
        lennum = http.lendate(url)
        num = 0
        for num in range(lennum):
            #print http.get_key_vlue(url,num,"type")
            if http.get_key_vlue(url,num,"type") not in typelist:
                typelist.append(http.get_key_vlue(url,num,"type"))
                print http.get_key_vlue(url,num,"word"), http.get_key_vlue(url,num,"type")
def start():
    row_date = 1
    andf = 1
    fromt = 1
    andm = 1
    tot =1
    bb = ''

    file = 'D:\work\code\ctriptest\datebase1.xls'
    data = read_excel.open_excel(file)
    table = data.sheet_by_name('all')
    f = open('ok.txt', 'w')
    f1 = open('no1.txt', 'w')
    f2 = open('no2.txt', 'w')
    f3 = open('no.txt', 'w')
    for row_date in range(1, read_excel.rownum(file,'all')):
        bb = table.cell(row_date, read_excel.find_colum(file,'all','keyword')).value
        #bb = 'shanghai'
        reload(sys)
        sys.setdefaultencoding('utf-8')
        bb = str(bb)
        result = Language_result(bb)
        time.sleep(1)
        if result[0] == "1":
            f.write(result[1])
            f.write("\n")
        else:
            f1.write("############################################")
            f1.write("\n")
            f1.write(result[1])
            f1.write("\n")
            f1.write("############################################")
            f1.write("\n")
            f1.write(result[2].replace(",","\n"))
            f1.write("\n")

            f2.write("############################################")
            f2.write("\n")
            f2.write(result[1])
            f2.write("\n")
            f2.write("############################################")
            f2.write("\n")
            f2.write(result[3].replace(",","\n"))
            f2.write("\n")

            f3.write(result[1])
            f3.write("\n")

    f.close()
    f1.close()
    f2.close()
    f3.close()