Github issues迁移,用户名处理, 限流需要请求等待,token
This commit is contained in:
parent
505d873ea6
commit
b7597c3fa7
|
@ -144,7 +144,7 @@ namespace :batch_add_issues do
|
|||
if total_count > 100
|
||||
total_page = (total_count / 100) + 1
|
||||
total_page.times do |i|
|
||||
sleep 30.seconds
|
||||
sleep 3.seconds
|
||||
add_github_issues_to_project(project, i + 1 + count)
|
||||
end
|
||||
else
|
||||
|
@ -157,7 +157,11 @@ namespace :batch_add_issues do
|
|||
# api_url = "https://gitee.com/api/v5/repos/mindspore/mindspore/issues?access_token=96a637aa055f15056e77e3cf11a67525&state=all&sort=created&direction=desc&page=#{page}&per_page=100"
|
||||
api_url = "https://api.github.com/repos/OpenXiangShan/XiangShan/issues?sort=created&direction=desc&per_page=100&state=all&page=#{page}"
|
||||
uri = URI.parse(api_url)
|
||||
response = Net::HTTP.get_response(uri)
|
||||
# response = Net::HTTP.get_response(uri)
|
||||
http = Net::HTTP.new(uri.hostname, uri.port)
|
||||
http.use_ssl = true
|
||||
comment_response = http.send_request('GET', uri.path, nil, {'Content-Type' => 'application/json','authorization' => "Bearer #{ENV['token']}"})
|
||||
|
||||
puts "gitee api response.code ===== #{response.code}"
|
||||
lists = JSON.parse(response.body)
|
||||
puts "lists.size =====#{lists.size}"
|
||||
|
@ -219,11 +223,14 @@ namespace :batch_add_issues do
|
|||
end
|
||||
|
||||
issue_number = issue['number']
|
||||
sleep 3.seconds
|
||||
sleep 1.seconds
|
||||
# comment_api_url = "https://gitee.com/api/v5/repos/mindspore/mindspore/issues/#{issue_number}/comments?access_token=96a637aa055f15056e77e3cf11a67525&page=1&per_page=100&order=asc"
|
||||
comment_api_url = "https://api.github.com/repos/OpenXiangShan/XiangShan/issues/#{issue_number}/comments?page=1&per_page=100"
|
||||
comment_uri = URI.parse(comment_api_url)
|
||||
comment_response = Net::HTTP.get_response(comment_uri)
|
||||
# comment_response = Net::HTTP.get_response(comment_uri)
|
||||
http = Net::HTTP.new(comment_uri.hostname, comment_uri.port)
|
||||
http.use_ssl = true
|
||||
comment_response = http.send_request('GET', comment_uri.path, nil, {'Content-Type' => 'application/json','authorization' => "Bearer #{ENV['token']}"})
|
||||
comment_lists = JSON.parse(comment_response.body)
|
||||
|
||||
comment_lists.each do |comment|
|
||||
|
|
Loading…
Reference in New Issue