python - 如何在邮递员中发送多个 GET 请求?
问题描述
我的目的是在一次调用中发送多个请求时检查 GET 调用的行为。比如说。
- 获取 https://{IP}:8181/restconf/
- 获取 https://{IP}:8181/restconf/data
我想一次发送两个请求,以便我应该同时获得两个请求的正文参数。
解决方案
newman 命令行实用程序不是为并行发送多个请求而设计的,
但您可以使用 powershell尝试多次运行集合。
$TargetPath=".\newman"
if (test-path ".\newman") {Remove-Item -r $TargetPath -Force}
New-Item -ItemType "directory" -path ".\newman\reports"
New-Item -ItemType "directory" -path ".\newman\logs"
For ($i=0; $i -le 10; $i++) {
$TestNewmanArgs="a.json -r cli,htmlextra --reporter-htmlextra-export newman\report-$i.html"
$argz="run $TestNewmanArgs -k
"$i"
Start-Process -FilePath "C:\Roaming\npm\newman" -ArgumentList $argz -PassThru
}
只需将其存储为 ps 文件,然后右键单击并使用 powershell 运行
这将在多个 cmd 进程中执行 newman
您还可以将 newmna 用作 nodejs 库并编写代码以并行运行脚本
推荐阅读
- amazon-web-services - 上传 CodeBuild 工件*如果*它们存在
- r - 确定为 odbc 存储驱动程序信息的位置
- python - 使用 argparse 导入文件时 Pytest 无法识别的参数
- go - HTTP处理函数返回后如何保持WebSocket连接打开?
- sql - windows 函数的正确语法
- c# - How to inject constructor which has two times the same interface with Autofac
- algorithm - 随机优化是否存在公认的“当前最佳行业标准”?(模拟退火、粒子群优化等)
- android - 如何更改应用程序边缘照明默认颜色
- google-earth-engine - 从 GEE 导出图像集中的图像
- java - eclipse 是否允许您按顺序运行包中的所有类?