Class: Proxy::CrawlBase
- Inherits:
-
Base
- Object
- Base
- Proxy::CrawlBase
- Defined in:
- lib/proxy/crawl_base.rb
Instance Method Summary collapse
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 |