Returns the appropriate connection adapter for the given URL.

        :rtype: requests.adapters.BaseAdapter
514450
def get_adapter(self, url):
        
        for (prefix, adapter) in self.adapters.items():

            if url.lower().startswith(prefix.lower()):
                return adapter

        # Nothing matches :-/
        raise InvalidSchema("No connection adapters were found for '%s'" % url)
161007
def DefaultAdapter(self):
    '''
    '''
    default_adapter = None

    for obj in mockobject.objects.keys():
        if obj.startswith('/org/bluez/') and 'dev_' not in obj:
            default_adapter = obj

    if default_adapter:
        return dbus.ObjectPath(default_adapter, variant_level=1)
    else:
        raise dbus.exceptions.DBusException(
            'No such adapter.', name='org.bluez.Error.NoSuchAdapter')
477709
def get(self, url: StrOrURL, *, allow_redirects: bool=True,
            **kwargs: Any) -> '_RequestContextManager':
        """"""
        return _RequestContextManager(
            self._request(hdrs.METH_GET, url,
                          allow_redirects=allow_redirects,
                          **kwargs))
922564
def _setup_adapter(self, namespace, route_prefix):
        
        self.serializer = JSONAPI(
            self.sqla.Model, prefix='{}://{}{}'.format(
                self.app.config['PREFERRED_URL_SCHEME'],
                self.app.config['SERVER_NAME'], route_prefix))
        for view in views:
            method, endpoint = view
            pattern = route_prefix + endpoint.value
            name = '{}_{}_{}'.format(namespace, method.name, endpoint.name)
            view = self._generate_view(method, endpoint)
            self.app.add_url_rule(pattern + '/',
                                  name + '_slashed',
                                  view,
                                  methods=[method.name],
                                  strict_slashes=False)
            self.app.add_url_rule(pattern, name, view, methods=[method.name])
58718
def setUrl(self, url):
        
        if isUrl(url):
            self._url = url
        else:
            raise exceptions.BadUrlException(url)
        return self
369602
def get_url_adapter(_domain_name):
    
    from werkzeug._compat import wsgi_decoding_dance

    domain = application.domains.get(_domain_name, {})
    server_name = None
    if domain.get('domain', ''):
        server_name = domain['domain']
        try:
            env = {}
            environ = request.environ
            env['url_scheme'] = environ['wsgi.url_scheme']
            env['default_method'] = environ['REQUEST_METHOD']

            def _get_wsgi_string(name):
                val = environ.get(name)
                if val is not None:
                    return wsgi_decoding_dance(val, "utf-8")

            env['script_name'] = _get_wsgi_string('SCRIPT_NAME')
            env['path_info'] = _get_wsgi_string('PATH_INFO')
            env['query_args'] = _get_wsgi_string('QUERY_STRING')
        except:
            env = {}
        adapter = url_map.bind(server_name, **env)
    else:
        try:
            env = request.environ
        except:
            #this env if for testing only
            env = {
                'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;'
                               'q=0.9,*/*;q=0.8',
                'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3',
                'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch',
                'HTTP_ACCEPT_LANGUAGE': 'uk,en-US;q=0.8,en;q=0.6',
                'HTTP_CACHE_CONTROL': 'max-age=0',
                'HTTP_CONNECTION': 'keep-alive',
                # 'HTTP_HOST': 'localhost:8080',
                'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Linux i686)',
                # 'PATH_INFO': '/',
                # 'QUERY_STRING': '',
                'REMOTE_ADDR': '127.0.0.1',
                'REQUEST_METHOD': 'GET',
                'REQUEST_URI': '/',
                'SCRIPT_NAME': '',
                'SERVER_NAME': 'localhost',
                'SERVER_PORT': '8080',
                'SERVER_PROTOCOL': 'HTTP/1.1',
                'wsgi.errors': None,
                'wsgi.file_wrapper': None,
                # 'wsgi.input': BytesIO(ntob('', 'utf-8')),
                'wsgi.multiprocess': False,
                'wsgi.multithread': False,
                'wsgi.run_once': False,
                'wsgi.url_scheme': 'http',
                'wsgi.version': (1, 0),
            }
        adapter = url_map.bind_to_environ(env)
    return adapter
1290940
def _get_url(self, resource, item, sys_id=None):
        

        url_str = '%(base_url)s/%(base_path)s/%(resource)s/%(item)s' % (
            {
                'base_url': self.base_url,
                'base_path': self.base_path,
                'resource': resource,
                'item': item
            }
        )

        if sys_id:
            return "%s/%s" % (url_str, sys_id)

        return url_str
80329
def connect(self, url: str):
        
        try:
            self.db = dataset.connect(url, row_type=stuf)
        except Exception as e:
            self.err(e, "Can not connect to database")
            return
        if self.db is None:
            self.err("Database " + url + " not found")
            return
        self.ok("Db", self.db.url, "connected")
328023
def url_to_resource(url, request=None):
    
    if request is None:
        request = get_current_request()
#    cnv = request.registry.getAdapter(request, IResourceUrlConverter)
    reg = get_current_registry()
    cnv = reg.getAdapter(request, IResourceUrlConverter)
    return cnv.url_to_resource(url)
1301067
def get_ssl_adapter_class(name='builtin'):
    """"""
    adapter = ssl_adapters[name.lower()]
    if isinstance(adapter, six.string_types):
        last_dot = adapter.rfind('.')
        attr_name = adapter[last_dot + 1:]
        mod_path = adapter[:last_dot]

        try:
            mod = sys.modules[mod_path]
            if mod is None:
                raise KeyError()
        except KeyError:
            # The last [''] is important.
            mod = __import__(mod_path, globals(), locals(), [''])

        # Let an AttributeError propagate outward.
        try:
            adapter = getattr(mod, attr_name)
        except AttributeError:
            raise AttributeError("'%s' object has no attribute '%s'"
                                 % (mod_path, attr_name))

    return adapter
225672
def get_url(self, url):
        
        if url.startswith('/'):
            url = '%s%s' % (self.base_url, url)
        return url
268405
def get(url):
    
    url = text_type(url)
    if url.find("://") == -1:
        Log.error("{{url}} must have a prototcol (eg http://) declared", url=url)

    base = URL("")
    if url.startswith("file://") and url[7] != "/":
        if os.sep=="\\":
            base = URL("file:///" + os.getcwd().replace(os.sep, "/").rstrip("/") + "/.")
        else:
            base = URL("file://" + os.getcwd().rstrip("/") + "/.")
    elif url[url.find("://") + 3] != "/":
        Log.error("{{url}} must be absolute", url=url)

    phase1 = _replace_ref(wrap({"$ref": url}), base)  # BLANK URL ONLY WORKS IF url IS ABSOLUTE
    try:
        phase2 = _replace_locals(phase1, [phase1])
        return wrap(phase2)
    except Exception as e:
        Log.error("problem replacing locals in\n{{phase1}}", phase1=phase1, cause=e)
357989
def get(self, url):
        
        self._query()
        return Enclosure(self._resp.get(url), url)
826405
def get_base_url(url, include_path=False):
    

    if not url:
        return None

    parts = _urlsplit(url)
    base_url = _urlunsplit((
        parts.scheme, parts.netloc, (parts.path if include_path else ''), None, None
    ))

    return base_url if base_url.endswith('/') else base_url + '/'
583533
def _get_connection_from_url(self, url, timeout, **kwargs):
        """"""

        url = self._decode_url(url, "")

        if url.scheme == 'http' or url.scheme == 'https':
            return HttpConnection(url.geturl(), timeout=timeout, **kwargs)
        else:
            if sys.version_info[0] > 2:
                raise ValueError("Thrift transport is not available "
                                 "for Python 3")

            try:
                from thrift_connection import ThriftConnection
            except ImportError:
                raise ImportError("The 'thrift' python package "
                                    "does not seem to be installed.")
            return ThriftConnection(url.hostname, url.port,
                                    timeout=timeout, **kwargs)
328250
def get(self, using=None, **kwargs):
        
        return self._get_connection(using).indices.get(index=self._name, **kwargs)
229978
def site_url(url):
    
    base_url = 'http://%s' % socket.gethostname()

    if server.port is not 80:
        base_url += ':%d' % server.port

    return urlparse.urljoin(base_url, url)