Module: Clients

Defined in:
lib/clients/tor_client.rb,
lib/clients.rb,
lib/clients/errors.rb,
lib/clients/version.rb,
lib/clients/ftp_client.rb,
lib/clients/http_client.rb,
lib/clients/url_decoder.rb,
lib/clients/proxy_client.rb,
lib/clients/proxy6_client.rb,
lib/clients/recaptcha/client.rb,
lib/clients/recaptcha/solver.rb,
lib/clients/proxy_list_client.rb,
lib/clients/recaptcha/response.rb,
lib/clients/http_client/response.rb

Overview

Proxy to Tor

From martincik.com/?p=402

Defined Under Namespace

Modules: Recaptcha, UrlDecoder Classes: ClientError, FtpClient, HttpClient, HttpClientError, Proxy6Client, ProxyClient, ProxyClientError, ProxyListClient, RecaptchaError, TorClient

Constant Summary collapse

VERSION =
"9.0.2"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.loggerObject



10
11
12
13
14
15
16
# File 'lib/clients.rb', line 10

def logger
  @logger ||= ::Logger.new("log/clients.log").tap do |logger|
    logger.formatter = proc do |severity, datetime, progname, msg|
      "#{datetime} #{progname} TID-#{Thread.current.object_id.to_s(36)} #{severity}: #{msg}\n"
    end
  end
end

Class Method Details

.setup_http_client(logger: nil) ⇒ Object

Helper to get default setup of HttpClient with ProxyClient



19
20
21
22
# File 'lib/clients.rb', line 19

def setup_http_client(logger: nil)
  proxy = Clients::ProxyClient.from_env
  Clients::HttpClient.new(proxy: proxy, logger: logger)
end