Python刷点击率,下载量代码

【代码仅作学习之用,勿用于非法用途】

#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @author: Wiker Yong

import urllib2, urllib;
from threading import Thread;
import re, os;
import time

'''
获取HTTP返回
'''

def download(url):
    try :
        handler = urllib2.urlopen(url, '', 50000);
        if handler.getcode()==200 :  #状态返回成功,注意不用进行读取数据
            print ("200,close") 
            handler.close();
    except:
        print("Except")
if __name__ == "__main__":
    while True:
        url = 'http://www.baidu.com';
        print(url);
        download(url);
        time.sleep(3); #休眠时间秒

基于pythond 2.7

【转载请注明出处】

    原文作者:猫大叔
    原文地址: https://blog.csdn.net/wiker_yong/article/details/10608107
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞