1. new 6 Sunday, May 31, 2015 11:10 PM
-- Initialize data store
local ds = datastore.open("emails")
-- Get a random row from data store
local row = ds:get_random()
-- The row is a table (array). Extract email from it
local email = row[1]
local password =
"sEEll9zqgTZVV03FSlt0lnz4UxfwMyolkb55U6AW%2BN5WIA6zfVulk7HkqifOpconEA%2BU3M1bBLrlyt1EVNumfQ%3D%3
D"
local post_data = "email=" .. email .. "&password=" .. password
http.request_batch({
{"POST", "http://genefo.com:8080/rest/user/login", data=post_data, auto_decompress=true},
{"GET", "http://genefo.com:8080/rest/user", auto_decompress=true},
{"GET", "http://genefo.com:8080/rest/profiles", auto_decompress=true}
})
local response = http.get({ url="http://genefo.com:8080/rest/profiles", response_body_bytes=
3000000})
local m = string.match(response.body,'"profileID":%d+')
local profileId = string.match(m,'%d+')
http.request_batch({
{"GET", "http://genefo.com:8080/app/home/post/index.html ", auto_decompress=true}
})
local urlcond = "http://genefo.com:8080/rest/profile/"..profileId.."/conditions/profiles/ids"
local data_cond = "start=0&count=10"
local resp_profiles = http.get({url = "http://genefo.com:8080/rest/profile/"..profileId..
"/conditions/profiles/ids?start=0&count=50" , response_body_bytes=400000})
local m1 = string.match(resp_profiles.body,'"profileIDs":.+')
--local m1 =resp_profiles.body[3]
m1=string.sub(m1,15)
m1=m1:gsub('%}','')
m1=m1:gsub('%]','')
--m1=string.match(m1,'|.*|')
--log.info(m1)
--log.info(m1)
local m2 ={}
for match in m1:gmatch("([^,%s]+)") do
m2[#m2 + 1] = tonumber(match)
end
--local profile = {}
--profiles = split(m1,',')
--log.info (profiles[1])
local profileFID = nil
for i=1, 50 do
profileFID = tostring(m2[i])
http.post({url = "http://genefo.com:8080/rest/profile/" .. profileId .. "/network?profileID="
.. profileFID, auto_decompress=true})
-1-
2. new 6 Sunday, May 31, 2015 11:10 PM
client.sleep(math.random(20, 40))
end
http.request_batch({
{"GET", "http://genefo.com:8080/app/home/post/index.html ", auto_decompress=true}
})
-- Initialize data store
log.info ('beginning post messages')
local dss = datastore.open("quotes")
for i=1, 50 do
local phrase = dss:get_random()
local think = phrase[1]
think = think:gsub('"',' ')
local num = math.random(20000)
local text = "{"note":" ".. think ..""}"
http.request_batch({
{"POST", "http://genefo.com:8080/rest/profile/" .. profileId .. "/story/general", headers={[
"Content-Type"]="application/json"}, data=text, auto_decompress=true}
})
client.sleep(math.random(5, 10))
end
-2-