Class: Proxy::CrawlBase
Instance Method Summary collapse
Methods inherited from Base
#format_response, #get_headers, #initialize, #prepare_request, #success_response?, #with_retry
Constructor Details
This class inherits a constructor from Proxy::Base
Instance Method Details
#fetch(url, proxy_from_server) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/proxy/crawl_base.rb', line 7 def fetch(url, proxy_from_server) = { 'token' => proxy_from_server['proxyToken'], proxy_from_server['proxyCountryKey'] => @country, 'url' => url }.merge(@query_params) response = with_retry do HTTParty.get(proxy_from_server['proxyHost'], query: , headers: @headers) end format_response(response) rescue StandardError => e @logger.error("Request failed error: #{e.}") nil end |