python实现模拟浏览器访问网页
来源:互联网 发布:重庆鸿巨网络怎么样 编辑:程序博客网 时间:2024/05/22 07:06
原文:http://blog.csdn.net/boksic/article/details/16870453
import urllib2 import timeit import thread import time i = 0 x = 0mylock = thread.allocate_lock() def test(no,r): global i url = 'http://blog.csdn.net/' for j in range(1,r): req=urllib2.Request(url) req.add_header("User-Agent","Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)") file = urllib2.urlopen(req) print file.getcode(); mylock.acquire() i+=1 mylock.release() print i; thread.exit_thread() def fast(): thread.start_new_thread(test,(1,50)) thread.start_new_thread(test,(2,50)) thread.start_new_thread(test,(3,50)) thread.start_new_thread(test,(4,50)) thread.start_new_thread(test,(5,50))thread.start_new_thread(test,(6,50))thread.start_new_thread(test,(7,50))for x in range(1,150): fast() time.sleep(0.08) x = x + 1
1 0
- python实现模拟浏览器访问网页
- python 使用 mechanize 模拟浏览器访问网页
- java 模拟浏览器访问网页
- [python]模拟浏览器下载网页
- python模拟浏览器访问网站
- 模拟浏览器访问网站,判断网页状态
- java中模拟浏览器访问网页(三)
- chrome浏览器怎么模拟手机访问网页
- python中模拟浏览器抓取网页(-)
- google chrome浏览器 模拟手机、浏览器访问手机网页
- 用Chrome配合Chales 模拟手机浏览器访问3G网页
- 模拟浏览器抓取网页
- 用python模拟一个文本浏览器来抓取网页
- python模拟打开Google浏览器并打开网页
- 浏览器访问网页过程
- 浏览器访问网页原理
- 浏览器访问网页全过程
- CURL模拟访问网页
- [Lua]Lua调用C/C++函数/库(动态链接方式)
- C++进阶必知
- PAT 1093. Count PAT's (25)
- 图论题大合集
- 和菜鸟一起学android4.0.3源码之USB wifi移植心得
- python实现模拟浏览器访问网页
- 里氏原则
- Vim的基础配置
- 使用SharePoint 2013 社区功能 可以分钟搭建 微博和BBS网站
- 深入学习C++
- MTK效率最高编译命令
- sqlserver基础操作
- C++易犯错误不可不知
- 测试一下