多线程请求乌云链接

admin 2023年12月23日14:46:21Python评论1,515 次浏览阅读模式

#coding=utf-8
import requests
import threading
import time
print "start:" + (time.strftime("%H:%M:%S"))
def access():
    for i in range(1,11):
        url = 'http://drops.wooyun.org/papers/7049'
        r = requests.get(url)
        if r.status_code == 200:
            print url
            print i 
#access()
threads = []
for i in xrange(5):
    t = threading.Thread(target=access)
    threads.append(t)
    t.start()
    t.join()

#way2

# for i in xrange(7):
#
     t = threading.Thread(target=access)
#
     threads.append(t)

# for i in threads:
#
     i.start()

# for i in threads:
#
     i.join()

 

print"end:" + (time.strftime("%H:%M:%S"))

 

相关文章
weinxin
我的微信
微信扫一扫
admin
  • 本文由 发表于 2023年12月23日14:46:21
  • 转载请务必保留本文链接:https://anyun.org/a/jishuguanzhu/bianchengchalou/python/2023/1223/14852.html

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: