Created
June 25, 2018 09:00
-
-
Save ebongzzang/76921729a9fbac68eb0ecb30a2a27b82 to your computer and use it in GitHub Desktop.
wrc lua script with csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local csv = require("csv") | |
local f = csv.open("device-table2.csv", {['header'] = true}) | |
local columns = {"id", "free_storage_in_byte", "used_storage_in_byte"} | |
local parameters = {} | |
local counter = 0 | |
for fields in f:lines() do | |
perRowCondition = {} | |
for index, value in pairs(fields) do | |
for _,v in pairs(columns) do | |
if v == index then | |
perRowCondition[v] = v .. "=".. value | |
end | |
end | |
end | |
parameters[#parameters +1] = perRowCondition | |
end | |
request = function() | |
counter = counter +1 | |
if counter >= #parameters then return end | |
parameter = parameters[counter] | |
local path = "/device/assets?" .. parameter.id .. "&" .. parameter.free_storage_in_byte .. "&" .. parameter.used_storage_in_byte | |
return wrk.format("GET",path) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment