local oauthToken = 'fe88b4293f12a0ddd5a94c3bba3f773108ad5325' -- your oauth token
local auth = "token " .. oauthToken -- value for Authroization header
print('Sending Log...')
local headers={ -- headers sent with every http request to github api
Authorization=auth, -- for authorization
Accept="application/vnd.github.v3+json", -- make sure we get correct version
["User-Agent"]="hbombSSPLogSystem" -- set to something unique, should probably include username (see https://developer.github.com/v3/#user-agent-required)
}
local f = fs.open('systemFiles/logFile.log', 'r')
logBody = f.readAll()
f.close()
print('Log Copied')
local owner = "hbomb79" -- owner of repository
local repo = "securitySystemPro" -- repository
local title = "Auto Bug Report" -- title of issue
title = title:gsub("\\", "\\\\"):gsub("\"", "\\\"") -- make JSON string
local body = 'Testing Log' -- body of issue
body = body:gsub("\\", "\\\\"):gsub("\"", "\\\"") -- make JSON string
local jsonObject=[[
{
"title" : "]] .. title .. [[",
"body" : "]] .. body .. [[",
}]]
print('JSON Assembled')
for i=1, 3 do
print('Send Attempt: '..i)
--if http.post("https://api.github.com/repos/" .. owner .. "/" .. repo .. "/issues", jsonObject, headers) then posted = true else posted = false end
if http.post("https://api.github.com/repos/" .. owner .. "/" .. repo .. "/issues?access_token=" .. oauthToken, jsonObject) then posted = true else posted = false end
i = i + 1
end
print('Posted: '..tostring(posted))
if posted == false then
print('Failed To Post Log Report')
sleep(1)
print('Loading Log:')
sleep(0.5)
error(logBody)
end
Sorry, But changing the body didnt help, any ideas??
Edited by Hbomb_79, 01 September 2014 - 04:49 AM.












