Advertisement

在python多线程处理任务,并读取文件发送请求

阅读量:

python多线程执行任务,读取文件,批量发请求

复制代码
     
    
复制代码
 # !/usr/bin/python

    
 # -*- coding: utf-8 -*-
    
 import requests
    
 import threading
    
 import time
    
 import Queue
    
 import json, urllib2
    
  
    
 # 添加线程  创建5个线程名
    
 threadList = ["Thread-1", "Thread-2", "Thread-3", "Thread-4", "Thread-5"]
    
 # 设置队列长度
    
 workQueue = Queue.Queue(300)
    
 # 线程池
    
 threads = []
    
 start = time.time()
    
  
    
  
    
 class myThread(threading.Thread):
    
     def __init__(self, name, q):
    
     threading.Thread.__init__(self)
    
     self.name = name

全部评论 (0)

还没有任何评论哟~