2016-12-02 148 views
3

我一直在試圖自動化我的github問題,但是我遇到了一個問題,腳本不會創建問題,它會拉動api和所有數據,並且應該如何工作,但它不會產生問題。我做錯了什麼地方不能按預期工作,這意味着我該如何自動創建問題本身?創建一個自動github問題

require 'net/http' 
require 'uri' 
require 'openssl' 
require 'json' 

ID = "ID" 
SECRET = "SECRET" 

def create_git_issue(user, pass, repo_name, repo_owner, 
        title, body, assignee, milestone, 
        labels) 
    url = URI("https://api.github.com/repos/#{repo_owner}/#{repo_name}/issues?client_id=#{ID}&client_secret=#{SECRET}") 
    Net::HTTP.start(url.host, url.port, 
     :use_ssl => url.scheme == "https", 
     :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http| 

     request = Net::HTTP::Post.new url.request_uri 
     request.basic_auth user, pass 

     response = http.request request 
     puts response 
     #puts response.body 
     issue = { 
     :title => title, 
     :body => body, 
     :assignee => assignee, 
     :milestone => milestone, 
     :labels => labels 
     } 
     data = JSON.generate(issue) 
     request.body = data 
     request["Header"] = "application/vnd.github.v3+json" 
    end 
end 

create_git_issue("user", "secret", "repo", "owner", 
       "Test issue #1", "test", "", nil, nil) 

響應:

#<Net::HTTPOK:0x2e2d7b8> 
[{"url":"https://api.github.com/repos/WhitewidowScanner/whitewidow/issues/30","r 
epository_url":"https://api.github.com/repos/WhitewidowScanner/whitewidow","labe 
ls_url":"https://api.github.com/repos/WhitewidowScanner/whitewidow/issues/30/lab 
els{/name}","comments_url":"https://api.github.com/repos/WhitewidowScanner/white 
widow/issues/30/comments","events_url":"https://api.github.com/repos/WhitewidowS 
canner/whitewidow/issues/30/events","html_url":"https://github.com/WhitewidowSca 
nner/whitewidow/issues/30","id":192271670,"number":30,"title":"Encoding errors w 
ith recursive spider","user":{"login":"Shazgul","id":20743799,"avatar_url":"http 
s://avatars.githubusercontent.com/u/20743799?v=3","gravatar_id":"","url":"https: 
//api.github.com/users/Shazgul","html_url":"https://github.com/Shazgul","followe 
rs_url":"https://api.github.com/users/Shazgul/followers","following_url":"https: 
//api.github.com/users/Shazgul/following{/other_user}","gists_url":"https://api. 
github.com/users/Shazgul/gists{/gist_id}","starred_url":"https://api.github.com/ 
users/Shazgul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.co 
m/users/Shazgul/subscriptions","organizations_url":"https://api.github.com/users 
/Shazgul/orgs","repos_url":"https://api.github.com/users/Shazgul/repos","events_ 
url":"https://api.github.com/users/Shazgul/events{/privacy}","received_events_ur 
l":"https://api.github.com/users/Shazgul/received_events","type":"User","site_ad 
min":false},"labels":[{"id":490987868,"url":"https://api.github.com/repos/Whitew 
idowScanner/whitewidow/labels/ENCODING","name":"ENCODING","color":"b60205","defa 
ult":false},{"id":458176860,"url":"https://api.github.com/repos/WhitewidowScanne 
r/whitewidow/labels/temp%20fix","name":"temp fix","color":"c2e0c6","default":fal 
se},{"id":480395818,"url":"https://api.github.com/repos/WhitewidowScanner/whitew 
idow/labels/testing","name":"testing","color":"d4c5f9","default":false}],"state" 
:"open","locked":false,"assignee":{"login":"Ekultek","id":14183473,"avatar_url": 
"https://avatars.githubusercontent.com/u/14183473?v=3","gravatar_id":"","url":"h 
ttps://api.github.com/users/Ekultek","html_url":"https://github.com/Ekultek","fo 
llowers_url":"https://api.github.com/users/Ekultek/followers","following_url":"h 
ttps://api.github.com/users/Ekultek/following{/other_user}","gists_url":"https:/ 
/api.github.com/users/Ekultek/gists{/gist_id}","starred_url":"https://api.github 
.com/users/Ekultek/starred{/owner}{/repo}","subscriptions_url":"https://api.gith 
ub.com/users/Ekultek/subscriptions","organizations_url":"https://api.github.com/ 
users/Ekultek/orgs","repos_url":"https://api.github.com/users/Ekultek/repos","ev 
ents_url":"https://api.github.com/users/Ekultek/events{/privacy}","received_even 
ts_url":"https://api.github.com/users/Ekultek/received_events","type":"User","si 
te_admin":false},"assignees":[{"login":"Ekultek","id":14183473,"avatar_url":"htt 
ps://avatars.githubusercontent.com/u/14183473?v=3","gravatar_id":"","url":"https 
://api.github.com/users/Ekultek","html_url":"https://github.com/Ekultek","follow 
ers_url":"https://api.github.com/users/Ekultek/followers","following_url":"https 
://api.github.com/users/Ekultek/following{/other_user}","gists_url":"https://api 
.github.com/users/Ekultek/gists{/gist_id}","starred_url":"https://api.github.com 
/users/Ekultek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.c 
om/users/Ekultek/subscriptions","organizations_url":"https://api.github.com/user 
s/Ekultek/orgs","repos_url":"https://api.github.com/users/Ekultek/repos","events 
_url":"https://api.github.com/users/Ekultek/events{/privacy}","received_events_u 
rl":"https://api.github.com/users/Ekultek/received_events","type":"User","site_a 
dmin":false}],"milestone":null,"comments":11,"created_at":"2016-11-29T12:42:07Z" 
,"updated_at":"2016-12-01T13:55:21Z","closed_at":null,"body":"### Before you cre 
ate an issue please make sure that there are no issues that relate to your issue 
you are trying to create, \r\nif there is an issue that relates to this, please 
add a comment to that one and describe your specific problem. There is\r\nalso 
a self help guide under the docs folder. Look through the troubleshooting and se 
lf help for help.\r\n--\r\n\r\n### Issue (be specific)\r\nAfter a -s Scan on a W 
ebpage, Whitewidow \"encountered an error and cannot continue\".. It totally sto 
ps the scan, also outputs a bunch of encoding errors\r\n\r\n### Exact error mess 
age\r\nruby whitewidow.rb -s browsergames.info\r\n[13:33:46 INFO] Found http://w 
ww.w3.org/1999/xhtml\r\n[13:33:46 INFO] Found http://www.w3.org/2003/g/data-view 
\r\n[13:33:46 INFO] Found http://www.w3.org/StyleSheets/TR/base\r\n[13:33:46 INF 
O] Found http://www.w3.org/2008/07/rdfa-xslt\r\n[13:33:46 INFO] Found http://www 
.w3.org/2003/g/data-view#\r\n[13:33:47 INFO] Found http://www.w3.org/1999/xhtml\ 
r\n[13:33:47 INFO] Found http://www.w3.org/2008/07/rdfa-xslt\r\n[13:33:47 INFO] 
Found http://www.w3.org/\r\n...\r\nencoding error : output conversion failed due 
to conv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : encoder error\r\nencodi 
ng error : output conversion failed due to conv error, bytes 0x89 0x50 0x4E 0x47 
\r\nI/O error : encoder error\r\n...\r\nencoding error : output conversion faile 
d due to conv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : encoder error\r\ne 
ncoding error : output conversion failed due to conv error, bytes 0x89 0x50 0x4E 
0x47\r\nI/O error : encoder error\r\n...\r\nencoding error : output conversion 
failed due to conv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : encoder error 
\r\nencoding error : output conversion failed due to conv error, bytes 0x89 0x50 
0x4E 0x47\r\nI/O error : encoder error\r\n...\r\nencoding error : output conver 
sion failed due to conv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : encoder 
error\r\nencoding error : output conversion failed due to conv error, bytes 0x89 
0x50 0x4E 0x47\r\nI/O error : encoder error\r\n...\r\nencoding error : output c 
onversion failed due to conv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : enc 
oder error\r\nencoding error : output conversion failed due to conv error, bytes 
0x89 0x50 0x4E 0x47\r\nI/O error : encoder error\r\n...\r\nencoding error : out 
put conversion failed due to conv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error 
: encoder error\r\nencoding error : output conversion failed due to conv error, 
bytes 0x89 0x50 0x4E 0x47\r\nI/O error : encoder error\r\nencoding error : outpu 
t conversion failed due to conv error, bytes 0xFF 0xC3 0x98 0xC3\r\nI/O error : 
encoder error\r\n...\r\nencoding error : output conversion failed due to conv er 
ror, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : encoder error\r\nencoding error : 
output conversion failed due to conv error, bytes 0x89 0x50 0x4E 0x47\r\nI/O err 
or : encoder error\r\n...\r\nencoding error : output conversion failed due to co 
nv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : encoder error\r\nencoding err 
or : output conversion failed due to conv error, bytes 0x89 0x50 0x4E 0x47\r\nI/ 
O error : encoder error\r\n...\r\nencoding error : output conversion failed due 
to conv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : encoder error\r\nencodin 
g error : output conversion failed due to conv error, bytes 0x89 0x50 0x4E 0x47\ 
r\nI/O error : encoder error\r\n...\r\nencoding error : output conversion failed 
due to conv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : encoder error\r\nen 
coding error : output conversion failed due to conv error, bytes 0x89 0x50 0x4E 
0x47\r\nI/O error : encoder error\r\nencoding error : output conversion failed d 
ue to conv error, bytes 0xFF 0xC3 0x98 0xC3\r\nI/O error : encoder error\r\n...\ 
r\nencoding error : output conversion failed due to conv error, bytes 0xA2 0x3C 
0x2F 0x70\r\nI/O error : encoder error\r\nencoding error : output conversion fai 
led due to conv error, bytes 0x89 0x50 0x4E 0x47\r\nI/O error : encoder error\r\ 
nencoding error : output conversion failed due to conv error, bytes 0xFF 0xC3 0x 
98 0xC3\r\nI/O error : encoder error\r\n...\r\nencoding error : output conversio 
n failed due to conv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : encoder err 
or\r\nencoding error : output conversion failed due to conv error, bytes 0x89 0x 
50 0x4E 0x47\r\nI/O error : encoder error\r\nencoding error : output conversion 
failed due to conv error, bytes 0xFF 0xC3 0x98 0xC3\r\nI/O error : encoder error 
\r\n...\r\nencoding error : output conversion failed due to conv error, bytes 0x 
A2 0x3C 0x2F 0x70\r\nI/O error : encoder error\r\nencoding error : output conver 
sion failed due to conv error, bytes 0x89 0x50 0x4E 0x47\r\nI/O error : encoder 
error\r\n...\r\nencoding error : output conversion failed due to conv error, byt 
es 0xA2 0x3C 0x2F 0x70\r\nI/O error : encoder error\r\nencoding error : output c 
onversion failed due to conv error, bytes 0x89 0x50 0x4E 0x47\r\nI/O error : enc 
oder error\r\n...\r\nencoding error : output conversion failed due to conv error 
, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : encoder error\r\nencoding error : out 
put conversion failed due to conv error, bytes 0x89 0x50 0x4E 0x47\r\nI/O error 
: encoder error\r\n...\r\nencoding error : output conversion failed due to conv 
error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : encoder error\r\nencoding error 
: output conversion failed due to conv error, bytes 0x89 0x50 0x4E 0x47\r\nI/O e 
rror : encoder error\r\nencoding error : output conversion failed due to conv er 
ror, bytes 0xFF 0xC3 0x98 0xC3\r\nI/O error : encoder error\r\n...\r\nencoding e 
rror : output conversion failed due to conv error, bytes 0xA2 0x3C 0x2F 0x70\r\n 
I/O error : encoder error\r\nencoding error : output conversion failed due to co 
nv error, bytes 0x89 0x50 0x4E 0x47\r\nI/O error : encoder error\r\n...\r\nencod 
ing error : output conversion failed due to conv error, bytes 0xA2 0x3C 0x2F 0x7 
0\r\nI/O error : encoder error\r\nencoding error : output conversion failed due 
to conv error, bytes 0x89 0x50 0x4E 0x47\r\nI/O error : encoder error\r\n...\r\n 
encoding error : output conversion failed due to conv error, bytes 0xA2 0x3C 0x2 
F 0x70\r\nI/O error : encoder error\r\nencoding error : output conversion failed 
due to conv error, bytes 0x89 0x50 0x4E 0x47\r\nI/O error : encoder error\r\n.. 
.\r\nencoding error : output conversion failed due to conv error, bytes 0xA2 0x3 
C 0x2F 0x70\r\nI/O error : encoder error\r\nencoding error : output conversion f 
ailed due to conv error, bytes 0x89 0x50 0x4E 0x47\r\nI/O error : encoder error\ 
r\nencoding error : output conversion failed due to conv error, bytes 0xFF 0xC3 
0x98 0xC3\r\nI/O error : encoder error\r\n...\r\nencoding error : output convers 
ion failed due to conv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : encoder e 
rror\r\nencoding error : output conversion failed due to conv error, bytes 0x89 
0x50 0x4E 0x47\r\nI/O error : encoder error\r\n...\r\nencoding error : output co 
nversion failed due to conv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : enco 
der error\r\nencoding error : output conversion failed due to conv error, bytes 
0x89 0x50 0x4E 0x47\r\nI/O error : encoder error\r\nencoding error : output conv 
ersion failed due to conv error, bytes 0xFF 0xC3 0x98 0xC3\r\nI/O error : encode 
r error\r\n...\r\nencoding error : output conversion failed due to conv error, b 
ytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : encoder error\r\nencoding error : output 
conversion failed due to conv error, bytes 0x89 0x50 0x4E 0x47\r\nI/O error : e 
ncoder error\r\n...\r\nencoding error : output conversion failed due to conv err 
or, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : encoder error\r\nencoding error : o 
utput conversion failed due to conv error, bytes 0x89 0x50 0x4E 0x47\r\nI/O erro 
r : encoder error\r\n...\r\nencoding error : output conversion failed due to con 
v error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : encoder error\r\nencoding erro 
r : output conversion failed due to conv error, bytes 0x89 0x50 0x4E 0x47\r\nI/O 
error : encoder error\r\n...\r\nencoding error : output conversion failed due t 
o conv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : encoder error\r\nencoding 
error : output conversion failed due to conv error, bytes 0x89 0x50 0x4E 0x47\r 
\nI/O error : encoder error\r\nencoding error : output conversion failed due to 
conv error, bytes 0x89 0x50 0x4E 0x47\r\nI/O error : encoder error\r\n...\r\nenc 
oding error : output conversion failed due to conv error, bytes 0xA2 0x3C 0x2F 0 
x70\r\nI/O error : encoder error\r\nencoding error : output conversion failed du 
e to conv error, bytes 0x89 0x50 0x4E 0x47\r\nI/O error : encoder error\r\nencod 
ing error : output conversion failed due to conv error, bytes 0xFF 0xC3 0x98 0xC 
3\r\nI/O error : encoder error\r\n...\r\nencoding error : output conversion fail 
ed due to conv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : encoder error\r\n 
encoding error : output conversion failed due to conv error, bytes 0x89 0x50 0x4 
E 0x47\r\nI/O error : encoder error\r\nencoding error : output conversion failed 
due to conv error, bytes 0xFF 0xC3 0x98 0xC3\r\nI/O error : encoder error\r\n.. 
.\r\nencoding error : output conversion failed due to conv error, bytes 0xA2 0x3 
C 0x2F 0x70\r\nI/O error : encoder error\r\nencoding error : output conversion f 
ailed due to conv error, bytes 0x89 0x50 0x4E 0x47\r\nI/O error : encoder error\ 
r\nencoding error : output conversion failed due to conv error, bytes 0xFF 0xC3 
0x98 0xC3\r\nI/O error : encoder error\r\n...\r\nencoding error : output convers 
ion failed due to conv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : encoder e 
rror\r\nencoding error : output conversion failed due to conv error, bytes 0x89 
0x50 0x4E 0x47\r\nI/O error : encoder error\r\n...\r\nencoding error : output co 
nversion failed due to conv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : enco 
der error\r\nencoding error : output conversion failed due to conv error, bytes 
0x89 0x50 0x4E 0x47\r\nI/O error : encoder error\r\n...\r\nencoding error : outp 
ut conversion failed due to conv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : 
encoder error\r\nencoding error : output conversion failed due to conv error, b 
ytes 0x89 0x50 0x4E 0x47\r\nI/O error : encoder error\r\n...\r\nencoding error : 
output conversion failed due to conv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O er 
ror : encoder error\r\nencoding error : output conversion failed due to conv err 
or, bytes 0x89 0x50 0x4E 0x47\r\nI/O error : encoder error\r\n[13:37:17 INFO] Fo 
und http://www.w3.org/1999/xhtml\r\n[13:37:17 INFO] Found http://www.browsergame 
s.info/index.php?a=out&u='\r\n[13:37:18 INFO] Found http://www.browsergames.info 
/index.php?a=out&go=1&u=mafiakoenig\r\n[13:37:18 INFO] Found http://www.browserg 
ames.info/index.php?a=out&go=1&u=mafiakoenig\r\n[13:37:18 INFO] Found http://www 
.browsergames.info/\r\n[13:37:18 INFO] Found http://www.browsergames.info/\r\n[1 
3:37:18 INFO] Found http://www.browsergames.info/\r\n[13:37:19 INFO] Found http: 
//www.browsergames.info/index.php?a=join\r\n[13:37:19 INFO] Found http://www.bro 
wsergames.info/index.php?a=user_cpl\r\n[13:37:19 INFO] Found http://www.browserg 
ames.info/index.php?a=out&go=1&u=rlk\r\n[13:37:19 INFO] Found http://js.adscale. 
de/getads.js\r\n[13:37:19 INFO] Found http://js.adscale.de/getads.js\r\n[13:37:2 
0 INFO] Found http://www.facebook.com/pages/browsergamesinfo/240976396022694\r\n 
[13:37:20 INFO] Found http://www.browsergames.info/index.php?a=page&amp;id=impre 
ssum\r\nencoding error : output conversion failed due to conv error, bytes 0xA2 
0x3C 0x2F 0x70\r\nI/O error : encoder error\r\nencoding error : output conversio 
n failed due to conv error, bytes 0x89 0x50 0x4E 0x47\r\nI/O error : encoder err 
or\r\n...\r\n[13:37:23 INFO] Found http://www.facebook.com/pages/browsergamesinf 
o/240976396022694\r\n[13:37:23 INFO] Found http://www.browsergames.info/index.ph 
p?a=page&amp;id=impressum\r\nencoding error : output conversion failed due to co 
nv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : encoder error\r\nencoding err 
or : output conversion failed due to conv error, bytes 0x89 0x50 0x4E 0x47\r\nI/ 
O error : encoder error\r\nencoding error : output conversion failed due to conv 
error, bytes 0xFF 0xC3 0x98 0xC3\r\nI/O error : encoder error\r\n...\r\nencodin 
g error : output conversion failed due to conv error, bytes 0xA2 0x3C 0x2F 0x70\ 
r\nI/O error : encoder error\r\nencoding error : output conversion failed due to 
conv error, bytes 0x89 0x50 0x4E 0x47\r\nI/O error : encoder error\r\nencoding 
error : output conversion failed due to conv error, bytes 0xFF 0xC3 0x98 0xC3\r\ 
nI/O error : encoder error\r\n[13:37:28 INFO] Found http://www.w3.org/1999/xhtml 
\r\n[13:37:28 INFO] Found http://www.browsergames.info/index.php?a=out&u='\r\n[1 
3:37:28 INFO] Found http://www.browsergames.info/index.php?a=out&go=1&u=mafiakoe 
nig\r\n[13:37:28 INFO] Found http://www.browsergames.info/index.php?a=out&go=1&u 
=mafiakoenig\r\n[13:37:28 INFO] Found http://www.browsergames.info/\r\n[13:37:29 
INFO] Found http://www.browsergames.info/\r\n[13:37:29 INFO] Found http://www.b 
rowsergames.info/\r\n[13:37:29 INFO] Found http://www.browsergames.info/index.ph 
p?a=join\r\n[13:37:29 INFO] Found http://www.browsergames.info/index.php?a=user_ 
cpl\r\n[13:37:29 INFO] Found http://www.browsergames.info/index.php?a=out&go=1&u 
=rlk\r\n[13:37:30 INFO] Found http://js.adscale.de/getads.js\r\n[13:37:30 INFO] 
Found http://js.adscale.de/getads.js\r\n[13:37:30 INFO] Found http://www.faceboo 
k.com/pages/browsergamesinfo/240976396022694\r\n[13:37:30 INFO] Found http://www 
.browsergames.info/index.php?a=page&amp;id=impressum\r\nencoding error : output 
conversion failed due to conv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : en 
coder error\r\nencoding error : output conversion failed due to conv error, byte 
s 0x89 0x50 0x4E 0x47\r\nI/O error : encoder error\r\n...\r\nencoding error : ou 
tput conversion failed due to conv error, bytes 0xB3 0x3C 0x2F 0x70\r\nI/O error 
: encoder error\r\nencoding error : output conversion failed due to conv error, 
bytes 0x89 0x50 0x4E 0x47\r\nI/O error : encoder error\r\n...\r\nencoding error 
: output conversion failed due to conv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O 
error : encoder error\r\nencoding error : output conversion failed due to conv e 
rror, bytes 0x89 0x50 0x4E 0x47\r\nI/O error : encoder error\r\nencoding error : 
output conversion failed due to conv error, bytes 0xFF 0xC3 0x98 0xC3\r\nI/O er 
ror : encoder error\r\n[13:37:42 INFO] Found http://www.w3.org/1999/xhtml\r\n[13 
:37:43 INFO] Found http://www.browsergames.info/index.php?a=out&u='\r\n[13:37:43 
INFO] Found http://www.browsergames.info/index.php?a=out&go=1&u=mafiakoenig\r\n 
[13:37:43 INFO] Found http://www.browsergames.info/index.php?a=out&go=1&u=mafiak 
oenig\r\n[13:37:43 INFO] Found http://www.browsergames.info/\r\n[13:37:43 INFO] 
Found http://www.browsergames.info/\r\n[13:37:44 INFO] Found http://www.browserg 
ames.info/\r\n[13:37:44 INFO] Found http://www.browsergames.info/index.php?a=joi 
n\r\n[13:37:44 INFO] Found http://www.browsergames.info/index.php?a=user_cpl\r\n 
[13:37:44 INFO] Found http://www.browsergames.info/index.php?a=out&go=1&u=rlk\r\ 
n[13:37:44 INFO] Found http://js.adscale.de/getads.js\r\n[13:37:45 INFO] Found h 
ttp://js.adscale.de/getads.js\r\n[13:37:45 INFO] Found http://www.facebook.com/p 
ages/browsergamesinfo/240976396022694\r\n[13:37:45 INFO] Found http://www.browse 
rgames.info/index.php?a=page&amp;id=impressum\r\nencoding error : output convers 
ion failed due to conv error, bytes 0xA2 0x3C 0x2F 0x70\r\nI/O error : encoder e 
rror\r\nencoding error : output conversion failed due to conv error, bytes 0x89 
0x50 0x4E 0x47\r\nI/O error : encoder error\r\n[13:37:45 ERROR] browsergames.inf 
o encountered an error and cannot continue.\r\n\r\n\r\n### Steps to reproduce\r\ 
nMake an Scan on browsergames.info\r\n\r\n### Search query if applicable\r\n-s b 
rowsergames.info\r\n\r\n### Whitewidow version number\r\n1.7.2.9\r\n\r\n### Ruby 
version number\r\nruby 2.3.1p112 (2016-04-26) [i386-linux-gnu]\r\n\r\n### Label 
s\r\n\r\n - [X] Bug\r\n - [X] Encoding\r\n - [ ] Enhancement\r\n - [ ] Question\ 
r\n - [ ] Email request"}] 
+0

GitHub上不使用基本身份驗證。你可能想看看github api https://developer.github.com/v3/ –

+0

@JustinWood我看過那個,這就是我想出的腳本。我錯過了認證部分嗎? – pwerhouse

+0

顯然如此。有一個頁面描述了認證。 https://developer.github.com/v3/#authentication –

回答

1

編輯之後好像你已經錯過了 '=' 跡象

URI("https://api.github.com/repos/#{repo_owner}/#{repo_name}/issues?client_id=#{ID}&client_secret=#{SECRET}") 

這應該整理出來。否則,你會得到什麼迴應?任何狀態碼或內容? GitHub會在迴應時提供錯誤訊息。

除此之外,你是一個GET請求時,你需要做一個POST請求(見here

改變這樣的代碼:

request = Net::HTTP::Post.new url.request_uri 
    request.basic_auth user, pass 

請記住,你需要作爲JSON字符串傳遞請求的主體。首先根據鏈路的規格創建對象:

body = { 
    title: "Test Issue # 1", 
    body: "test" 
} 

body = JSON.generate(body) 

然後追加,爲您的要求爲身體:

request.body = body 
request["Content-Type"] = "application/json" 
+0

同樣的問題,它會提取所有數據和所有內容,顯示信息,但不會產生問題。 – pwerhouse

+0

響應代碼和響應究竟是什麼? :)它會幫助我們幫助你。 –

+0

只需在問題 – pwerhouse