在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
1 require 'net/https' 2 require 'uri' 3 4 def post_api(api, args) 5 uri = URI.parse api 6 http = Net::HTTP.new(uri.host, uri.port) 7 http.use_ssl = true 8 req = Net::HTTP::Post.new(uri.request_uri) 9 req.set_form_data(args) 10 response = http.request(req) 11 JSON.load(response.body) 12 end 13 14 def get_api(api, args) 15 uri = URI.parse api 16 uri.query = args.collect { |a| "#{a[0]}=#{URI::encode(a[1].to_s)}" }.join('&') 17 http = Net::HTTP.new(uri.host, uri.port) 18 http.use_ssl = true 19 req = Net::HTTP::Get.new(uri.request_uri) 20 response = http.request(req) 21 JSON.load(response.body) 22 end
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论