码迷,mamicode.com
首页 > Web开发 > 详细

webserver interface test script

时间:2014-08-22 19:42:49      阅读:248      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   文件   for   div   cti   

 1 import urllib.request,json
 2 
 3 
 4 
 5 country=[id,th,vn,in,br,me,ru,na,hk]
 6 url_lst=[
 7 .server.voga360.com/nclient/sjson/playpicture/playPicture.htm?mtypeCode=1,
 8 .server.voga360.com/nclient/sjson/playpicture/playPicture.htm?mtypeCode=2,
 9 .server.voga360.com/nclient/sjson/recommend/recommend.htm?a=recmd_app_home_1,
10 .server.voga360.com/nclient/sjson/recommend/recommend.htm?a=recmd_game_home_1,
11 .server.voga360.com/nclient/sjson/recommend/recommend.htm?a=recmd_app_releases_1,
12 .server.voga360.com/nclient/sjson/recommend/recommend.htm?a=recmd_game_releases_1,
13 .server.voga360.com/nclient/sjson/subject/subjectInfo.htm?subjectInfoId=393,
14 .server.voga360.com/nclient/sjson/subject/subject.htm?mtypeCode=1,
15 .server.voga360.com/nclient/sjson/rank/topRankList.htm?mtypeCode=2&typeCode=0,
16 .server.voga360.com/nclient/sjson/rank/topRankList.htm?mtypeCode=1&typeCode=0,
17 .server.voga360.com/nclient/sjson/rank/topNewRankList.htm?mtypeCode=1&typeCode=0,
18 .server.voga360.com/nclient/sjson/rank/topNewRankList.htm?mtypeCode=2&typeCode=0,
19 .server.voga360.com/nclient/sjson/rank/topTrendRankList.htm?mtypeCode=1&typeCode=0,
20 .server.voga360.com/nclient/sjson/rank/topTrendRankList.htm?mtypeCode=2&typeCode=0,
21 .server.voga360.com/nclient/sjson/category/categoriesDownload.htm?currentPage=1&mtypeCode=1&typeCode=21,
22 .server.voga360.com/nclient/sjson/category/categoriesDownload.htm?currentPage=1&mtypeCode=2&typeCode=0,
23 .server.voga360.com/nclient/sjson/category/categoriesRate.htm?currentPage=1&mtypeCode=1&typeCode=5,
24 .server.voga360.com/nclient/sjson/category/categoriesRate.htm?currentPage=1&mtypeCode=2&typeCode=0,
25 .server.voga360.com/nclient/sjson/category/categoriesTrend.htm&currentPage=4&mtypeCode=1&typeCode=19,
26 .server.voga360.com/nclient/sjson/category/categoriesTrend.htm&currentPage=4&mtypeCode=2&typeCode=0,
27 .server.voga360.com/nclient/sjson/category/categoriesLatest.htm?currentPage=1&mtypeCode=1&typeCode=10,
28 .server.voga360.com/nclient/sjson/category/categoriesLatest.htm?currentPage=1&mtypeCode=2&typeCode=0]
29 
30 #country=[‘gl‘,]
31 urla=http://
32 
33 
34 def cnt_md(country,url_lst):
35     for urlm in country:
36         for urlp in url_lst:
37             print (urlm,urlp)
38             urlr=urla+urlm+urlp
39             print (Connect to %s\n % urlr)
40             fd=open(t.log,w)
41             req = urllib.request.Request(urlr)
42 
43             response = urllib.request.urlopen(req)
44             the_page = response.read()
45             print (the_page,file=fd)
46 
47             fd.close()
48             fd=open(t.log,r)
49             lines=fd.readlines()
50             s=lines[0]
51             print (find md5 %d times\n\n\n\n % s.count(md5))
52 
53 
54 cnt_md(country,url_lst)

在抓取到的流文件中寻找md5字段,此脚本还需添加返回错误时的处理,否则会跳出停止,to be continue...//my second day @sohu_cyou

webserver interface test script

标签:style   blog   http   color   os   文件   for   div   cti   

原文地址:http://www.cnblogs.com/johvoo/p/3930114.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!