Generate the Engine.IO connection URL.
761861
def _get_engineio_url(self, url, engineio_path, transport):
        """"""
        engineio_path = engineio_path.strip('/')
        parsed_url = urllib.parse.urlparse(url)

        if transport == 'polling':
            scheme = 'http'
        elif transport == 'websocket':
            scheme = 'ws'
        else:  # pragma: no cover
            raise ValueError('invalid transport')
        if parsed_url.scheme in ['https', 'wss']:
            scheme += 's'

        return ('{scheme}://{netloc}/{path}/?{query}'
                '{sep}transport={transport}&EIO=3').format(
                    scheme=scheme, netloc=parsed_url.netloc,
                    path=engineio_path, query=parsed_url.query,
                    sep='&' if parsed_url.query else '',
                    transport=transport)
972443
def _build_url(self):
        """"""
        if self.connection.get("username") and self.connection.get("password"):
            auth = "%s:%s@" % (self.connection["username"],
                               self._encoded_password)
            if self.connection.get("domain"):
                auth = r"%s;%s" % (self.connection["domain"], auth)
        else:
            auth = ""

        # Optional port number
        port = self.connection.get("port")
        port = ":" + port if port else ""

        # Construct mount_url
        self.connection["mount_url"] = "//%s%s%s/%s" % (
            auth, self.connection["url"], port, self.connection["share_name"])
183072
def connect(self, urls=None, **overrides):
        """"""
        if urls is not None:
            overrides['urls'] = urls
        return self.where(accept='CONNECT', **overrides)
315751
def raw_connection_from(engine_or_conn):
    
    if hasattr(engine_or_conn, 'cursor'):
        return engine_or_conn, False
    if hasattr(engine_or_conn, 'connection'):
        return engine_or_conn.connection, False
    return engine_or_conn.raw_connection(), True
1036886
function buildURL(dbName, opts) {
  var authentication
  opts.scheme = opts.scheme || 'http'
  opts.host   = opts.host   || '127.0.0.1'
  opts.port   = opts.port   || '5984'

  if (has(opts, 'auth')) {
    if (typeof opts.auth === 'object') {
      authentication = opts.auth.username + ':' + opts.auth.password + '@'
    }
  }

  return opts.scheme + '://' + authentication + opts.host + ':' + opts.port + '/' + dbName
}
848338
def url(proto, server, port=None, uri=None):
        """"""
        url_parts = [proto, '://', server]
        if port:
            port = int(port)
            if port < 1 or port > 65535:
                raise ValueError('invalid port value')
            if not ((proto == 'http' and port == 80) or
                    (proto == 'https' and port == 443)):
                url_parts.append(':')
                url_parts.append(str(port))

        if uri:
            url_parts.append('/')
            url_parts.append(requests.utils.quote(uri.strip('/')))

        url_parts.append('/')
        return ''.join(url_parts)
401890
function () {
        var guid = generateGuid();

        var queryString = 'guid=' + generateGuid();

        queryString = ortc.appKey ? queryString + '&appkey=' + ortc.appKey : queryString;

        loadClusterServerScript(clusterUrl + '/?' + queryString, guid, function (clusterServerResolved, scriptGuid) {
            if (clusterServerResolved) {
                url = SOCKET_SERVER;
                sockjs = createSocketConnection(ortc.getUrl());
            }

            try {
                clearScripts(scriptGuid);
            } catch (loadError) { }
        });
    }
1195447
private String getUrl(DataSource dataSource) {
        Connection conn = null;
        try {
            conn = dataSource.getConnection();
            return conn.getMetaData().getURL();
        } catch (SQLException e) {
            throw new PageException(e);
        } finally {
            if (conn != null) {
                try {
                    if (closeConn) {
                        conn.close();
                    }
                } catch (SQLException e) {
                    //ignore
                }
            }
        }
    }
1230720
def _url(self, uri):
        """"""
        prefix = "{}://{}{}".format(
            self._protocol,
            self.real_connection.host,
            self._port_postfix(),
        )
        return uri.replace(prefix, '', 1)
327340
def generate(self, **options):
        ''''''

        if options.get('unsafe', False):
            return unsafe_url(**options)
        else:
            return self.generate_new(options)
936860
async def _make_connection(self):
        """"""
        return await aioredis.create_redis(
            'redis://{}:{}'.format(
                self._redis_params.get('host', 'localhost'),
                self._redis_params.get('port', 6379)
            ),
            db=int(self._redis_params.get('db', 1))
        )
1261948
def buildUrl(self, cache_friendly=False):
    
    params = collections.OrderedDict()
    params["client"] = "tw-ob"
    params["ie"] = "UTF-8"
    params["idx"] = str(self.segment_num)
    if self.segment_count is not None:
      params["total"] = str(self.segment_count)
    params["textlen"] = str(len(self.text))
    params["tl"] = self.lang
    lower_text = self.text.lower()
    params["q"] = lower_text
    return "%s?%s" % (__class__.BASE_URL, urllib.parse.urlencode(params))
648935
def connection(self):
        """"""
        if not self._connection:
            logger.debug('Opening connection to: {}'.format(self.dsn))
            self._connection = self.engine.connect()
            logger.debug('Opened connection to: {}'.format(self.dsn))

        # logger.debug("Opening connection to: {}".format(self.dsn))
        return self._connection
1030042
def generate_rest_url(action, object_type, object_id = nil)
      url = custom_url_for(object_type, action)

      method = if action == :list || action == :show
        :get
      elsif action == :create
        :post
      elsif action == :update
        :put
      end

      if url
        url.request_method ||= method
        if object_id
          url.path.sub!(':id', object_id.to_s)
        end
        return url if url
      end

      path = ''
      path += @contexts.collect { |name, value|
        "#{name}/#{value}"
      }.join('/')
      path += '/'
      if action == :list || action == :create
        path += object_type.to_s.pluralize
      elsif action == :show || action == :update
        path += "#{object_type.to_s.pluralize}/#{object_id.to_s}"
      end
      url = generate_url(path)

      ServiceUrl.new(url, method)
    end
388554
async def random_connection(self):
        
        addr = choice(list(self._connections.keys()))
        return await self.env.connect(addr)
50608
def get_sessionmaker(sqlalchemy_url, engine=None):
    
    if engine is None:
        engine = create_engine(sqlalchemy_url)
    return sessionmaker(bind=engine)
180837
def build_url(self):
        
        url = "%s/1.0/%s/%s/%s" % (
            self.request.endpoint.get_url(),
            self.request.api_object,
            self.request.api_method,
            to_hex(self.request.nonce)
        )
        return url