class HttpCrawler::Proxy::TestProxyApi::Client
Public Instance Methods
get_proxy(parameter = {})
click to toggle source
# File lib/http_crawler/proxy/test_proxy_api/client.rb, line 21 def get_proxy(parameter = {}) r = http.get("/api/get_proxy") r.extend(HttpCrawler::Proxy::TestProxyApi::Response::GetProxy) end
init_uri()
click to toggle source
这是个错误代码 http类不能唯一,如果唯一的话高并发情况下会导致前一个请求未结束,下一个请求已经在发送,会出现冲突 class << self
def new(*args) @client ||= super(*args) end
end
# File lib/http_crawler/proxy/test_proxy_api/client.rb, line 16 def init_uri @uri = URI("http://127.0.0.1:1111/") end