Internal: Provides access to the Faraday::Connection used by this client
 for all requests to the server.

 Returns a Faraday::Connection
321557
def connection
      @connection ||= Faraday.new(url) do |conn|
        conn.response(:parse_json)
        # Request compressed responses from ES and decompress them
        conn.use(:gzip)
        conn.request(:encode_json)
        conn.request(:opaque_id) if @opaque_id
        conn.request(:limit_size, max_request_size: max_request_size) if max_request_size
        conn.request(:elastomer_compress, compression: compression) if compress_body

        if @adapter.is_a?(Array)
          conn.adapter(*@adapter)
        else
          conn.adapter(@adapter)
        end

        conn.options[:timeout]      = read_timeout
        conn.options[:open_timeout] = open_timeout
      end
    end
947226
def get_connection(self):
        """"""
        if self.host is None:
            connector = SpamCUnixConnector
            conn = connector(self.socket_file, self.backend_mod)
        else:
            connector = SpamCTcpConnector
            conn = connector(
                self.host,
                self.port,
                self.backend_mod,
                is_ssl=self.is_ssl,
                **self.ssl_args)
        return conn
442159
def connection
      @connection ||= Faraday.new "https://my.ecwid.com" do |conn|
        conn.request  :url_encoded
        conn.response :json, content_type: /\bjson$/
        conn.adapter  Faraday.default_adapter
      end
    end
256295
def connection
      if ::Fog::const_defined? @account[:service]
        service_mod = ::Fog::const_get @account[:service]
        provider_class = service_mod.send(:const_get, @account[:provider])
        @fog_service ||= provider_class.new(@account[:credentials])
      else
        provider_mod = ::Fog::const_get @account[:provider]
        service_class = provider_mod.send(:const_get, @account[:service])
        @fog_service ||= service_class.new(@account[:credentials])
      end
    end
1189456
def _connection(self):
        
        if self._pipelined_connection is not None:
            if self._pipelined_connection.share_in_threads or \
                    threading.current_thread().ident == self._pipelined_connection.current_thread_id:
                return self._pipelined_connection


        return self._direct_connection
196295
def get_connection(self):
        
        conn = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
        try:
            conn.bind(self._agent._get_filename())
            conn.listen(1)
            (r, addr) = conn.accept()
            return r, addr
        except:
            raise
1238261
def call(request_env)
      request_body = request_env[:body]

      begin
        request_env[:body] = request_body

        @app.call(request_env).on_complete do |response_env|
          status_code = response_env.status

          if @times > 0 && (status_code == 408 || (status_code >= 500 && status_code != 501 && status_code != 505))
            sleep @delay
            fail 'faraday_retry'
          end
        end
      rescue Exception => e
        raise e if e.message != 'faraday_retry'
        @times = @times - 1
        retry
      end
    end
522575
def connection opts={}
      connection = Faraday.new(opts) do |conn|

        if opts[:force_urlencoded]
          conn.request :url_encoded
        else
          conn.request :json
        end

        conn.request :json
        conn.use FaradayMiddleware::FollowRedirects
        conn.use FaradayMiddleware::Mashify
        conn.use FaradayMiddleware::ParseJson, :content_type => /\bjson$/
        conn.use FaradayMiddleware::ParseXml, :content_type => /\bxml$/
        conn.adapter adapter
      end

      connection.headers[:user_agent] = user_agent
      connection
    end
725409
def connection
        return @connection unless @connection.nil?

        options = {}
        options[:proxy] = proxy unless proxy.nil?
        options[:scheme], options[:host], options[:port]=url.scan(/(.*):\/\/(.*):([0-9]*)/).first

        @connection ||= Excon::Connection.new(options)
        #:read_timeout => self.class.read_timeout,
        #:write_timeout => self.class.write_timeout,
        #:connect_timeout => self.class.connect_timeout
      end
643891
def connection
      @connection ||= self.class.connection_class.connect(
        url: config.solr.url,
        read_timeout: config.solr.read_timeout,
        open_timeout: config.solr.open_timeout,
        proxy: config.solr.proxy,
        update_format: config.solr.update_format || :xml
      )
    end
269442
def get_connection(name='default', use_strict_redis=False):
    
    from .settings import QUEUES
    return get_redis_connection(QUEUES[name], use_strict_redis)
1199001
def get(path, options={}, raw=false, faraday_options={})
      request(:get, path, options, raw, faraday_options)
    end
532808
def server(self, ):
        
        c = connection.ServerConnection3(self)
        with self.mutex:
            self.connections.append(c)
        return c
165037
def request(uri, method = :get, body = nil, query = nil, content_type = nil)
      headers = {}

      {
        'Content-Type'                  => content_type || 'application/json',
        'User-Agent'                    => "Parse for Ruby, #{VERSION}",
        Protocol::HEADER_MASTER_KEY     => @master_key,
        Protocol::HEADER_APP_ID         => @application_id,
        Protocol::HEADER_API_KEY        => @api_key,
        Protocol::HEADER_SESSION_TOKEN  => @session_token
      }.each do |key, value|
        headers[key] = value if value
      end

      uri = ::File.join(path, uri)
      response = @session.send(method, uri, query || body || {}, headers)
      response.body

    # NOTE: Don't leak our internal libraries to our clients.
    # Extend this list of exceptions as needed.
    rescue Faraday::Error::ClientError => e
      raise Parse::ConnectionError, e.message
    end
22770
def connection
      return @connection if defined? @connection

      options = {
        request: {
          timeout: Nominatim.config.timeout
        }
      }

      @connection = Faraday.new Nominatim.config.endpoint, options do |builder|
        builder.use Nominatim::Response::ParseJson
        builder.adapter Faraday.default_adapter
      end

      @connection.params[:format] = 'json'
      @connection.params[:email] = Nominatim.config.email if Nominatim.config.email
      @connection.params[:key] = Nominatim.config.key if Nominatim.config.key

      @connection.headers[:user_agent] = Nominatim.config.user_agent
      @connection.headers[:"accept-language"] = Nominatim.config.accept_language

      @connection
    end
880575
def client(self):
        
        if self._client is None:
            self._client = KeycloakClient(server_url=self._server_url,
                                          headers=self._headers)
        return self._client
376411
def connection
      @connection ||= build_connection

      unless @connection.builder.handlers.include?(FaradayMiddleware::FollowRedirects)
        @connection.builder.insert(-2, FaradayMiddleware::FollowRedirects)
      end

      return @connection
    end