rest 循环请求

admin2021-01-15  1.2K+

import console; 
import web.rest.client
 
// 保存测试文件
_path = "~\key.txt"
var text = /*
line0
line1
line2
line3
line4
line5
line6
line7
line8
line9
*/
string.save(_path, text)
  
var http = web.rest.client()
var api = http.api("http://eu.httpbin.org/?{0}={1}","GET")
  
// 附加到所有请求URL的默认参数
http.extraUrlParameters = {
    j = 1;
    c = 3;
    path_column = 1
}
 
// 打开文件流
var file = io.open(_path)
while( var line = file.read() ) {
    var ret = api.search[line]()
    console.log( http.lastRequestMethod, http.ok(), http.lastRequestUrl )
}
 
// 关闭文件流移除文件
file.close()
io.remove( _path )
  
console.pause(true);
转载请注明原文地址: http://www.aardio.net/read-131.html
最新回复(0)
源码分享
aardio源码分享