python实现多线程post方法进行压测脚本模板
来源:互联网 发布:服务器安装centos系统 编辑:程序博客网 时间:2024/06/06 02:00
#coding=utf-8import httplib,urllibfrom time import ctime import threading import csv postJson={ }#定义需要进行发送的数据params = urllib.urlencode(postJson);#定义一些文件头headers = {"Content-Type":"application/x-www-form-urlencoded", "Connection":"Keep-Alive" }#创建请求函数def Clean(): #接口的urlrequrl ="" #连接服务器 conn = httplib.HTTPConnection("") #发送请求 conn.request(method="POST",url=requrl,body=params,headers=headers) #获取请求响应 response=conn.getresponse() #打印请求状态print response.status #创建数组存放线程 threads=[] #创建100个线程for i in range(100): #针对函数创建线程 t=threading.Thread(target=Clean,args=()) #把创建的线程加入线程组 threads.append(t) print 'start:', ctime() if __name__ == '__main__': #启动线程 for i in threads: i.start() #keep thread for i in threads: i.join()print 'end:', ctime() #Url.close()
阅读全文
0 0
- python实现多线程post方法进行压测脚本模板
- python实现多线程压测post接口服务
- python多线程get与post请求模板代码
- python实现的模板生成脚本
- python post action 脚本
- python多线程有几种实现方法
- python实现SimpleHTTPServer的POST方法
- python多线程异步post请求脚本,可以设置持续运行时间、线程数、时间间隔
- python 多线程模板
- python 多线程脚本
- python进行多线程计算
- Python 3.4.3 使用threading模块进行多线程编码实现
- python日志处理脚本模板
- HttpURLConnection-Post方法实现
- java实现post方法
- PYTHON实现简单的多线程实现输入等待的方法
- python多线程运维脚本
- C++ 多线程调用Python脚本
- EffectiveC++学习笔记-条款3
- 【每天一点linux】进程间通信--信号
- Ubuntu16.04 安装 Adouble Falsh Player
- 学习kotlin第13天_具体化的类型参数、内联属性、解构声明、集合
- 在Android Studio 和 Eclipse 的 git 插件操作 "代码提交"以及"代码冲突"
- python实现多线程post方法进行压测脚本模板
- Java基础教程23-static举例
- 湖北民族学院oj 1692(贪心) 之 木棒
- oracle 的几个函数instr(),substr(),nvl()
- Vim插件
- MFC:在CView(或CScrollView等)界面上动态添加右键菜单
- 邦德市
- 闭包与高阶函数
- 常用 Git 命令清单