Jump to content




Bug Reporting


  • You cannot reply to this topic
24 replies to this topic

#21 hbomb79

  • Members
  • 352 posts
  • LocationOrewa, New Zealand

Posted 01 September 2014 - 04:37 AM

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.


#22 hbomb79

  • Members
  • 352 posts
  • LocationOrewa, New Zealand

Posted 01 September 2014 - 04:45 AM

gist, repo, user Are the scopes ive issued the token...

Edit: I added write:public_key

Edited by Hbomb_79, 01 September 2014 - 04:51 AM.


#23 natedogith1

  • Members
  • 110 posts

Posted 01 September 2014 - 04:51 AM

Huh, I wonder what issue is causing it to return nil (if github didn't require https one could probably just watch it in wireshark). I think I remember hearing about some versions of ComputerCraft having issues if both postData and headers are used in a single request.

#24 hbomb79

  • Members
  • 352 posts
  • LocationOrewa, New Zealand

Posted 01 September 2014 - 04:55 AM

View Postnatedogith1, on 01 September 2014 - 04:51 AM, said:

Huh, I wonder what issue is causing it to return nil (if github didn't require https one could probably just watch it in wireshark). I think I remember hearing about some versions of ComputerCraft having issues if both postData and headers are used in a single request.

So theres no fix... I mean Ive seen this done before, I just cant find it any where on the Internet

EDIT: Ill keep trying but I have no experience with HTTP or anything of the sort which means I really dont know where to start, Im sure someone here has some advice on why the code doesnt want to work

Edited by Hbomb_79, 01 September 2014 - 05:55 AM.


#25 hbomb79

  • Members
  • 352 posts
  • LocationOrewa, New Zealand

Posted 18 September 2014 - 09:04 PM

Well, using help from oeed I have used my new website to receive information from computercraft and then submit it to my github issues page.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users