Return current servers
        
        :param vhost: return only servers of vhost if specified. '' to return only default servers.
                      None for all servers.
486048
def getservers(self, vhost = None):
        '''
        
        '''
        if vhost is not None:
            return [s for s in self.connections if s.protocol.vhost == vhost]
        else:
            return list(self.connections)
946331
def GetAllServers(alias=None,name_groups=False):
		
		if alias is None:  alias = clc.v1.Account.GetAlias()
		servers = []
		clc.v1.Account.GetLocations()
		for location in clc.LOCATIONS:
			try:
				r = clc.v1.API.Call('post','Server/GetAllServers', {'AccountAlias': alias, 'Location': location }, hide_errors=[5,] )
				if name_groups:  r['Servers'] = clc.v1.Group.NameGroups(r['Servers'],'HardwareGroupUUID')
				if int(r['StatusCode']) == 0:  servers += r['Servers']
			except:
				pass
		return(servers)
363911
def _get_server(self):
        
        with self._lock:
            inactive_server_count = len(self._inactive_servers)
            for i in range(inactive_server_count):
                try:
                    ts, server, message = heapq.heappop(self._inactive_servers)
                except IndexError:
                    pass
                else:
                    if (ts + self.retry_interval) > time():
                        # Not yet, put it back
                        heapq.heappush(self._inactive_servers,
                                       (ts, server, message))
                    else:
                        self._active_servers.append(server)
                        logger.warn("Restored server %s into active pool",
                                    server)

            # if none is old enough, use oldest
            if not self._active_servers:
                ts, server, message = heapq.heappop(self._inactive_servers)
                self._active_servers.append(server)
                logger.info("Restored server %s into active pool", server)

            server = self._active_servers[0]
            self._roundrobin()

            return server
1346580
def proxy_servers(self):
        
        proxy_servers = {}
        if self._load_rc_func is None:
            return proxy_servers
        else:
            HTTP_PROXY = os.environ.get('HTTP_PROXY')
            HTTPS_PROXY = os.environ.get('HTTPS_PROXY')

            if HTTP_PROXY:
                proxy_servers['http'] = HTTP_PROXY

            if HTTPS_PROXY:
                proxy_servers['https'] = HTTPS_PROXY

            proxy_servers_conf = self._load_rc_func().get('proxy_servers', {})
            proxy_servers.update(proxy_servers_conf)

            return proxy_servers
1145147
def get_vhost(self, name):
        
        return self._api_get('/api/vhosts/{0}'.format(
            urllib.parse.quote_plus(name)
        ))
837723
def get_current_url():
    
    if current_app.config.get('SERVER_NAME') and (
            # Check current hostname against server name, ignoring port numbers, if any (split on ':')
            request.environ['HTTP_HOST'].split(':', 1)[0] != current_app.config['SERVER_NAME'].split(':', 1)[0]):
        return request.url

    url = url_for(request.endpoint, **request.view_args)
    query = request.query_string
    if query:
        return url + '?' + query.decode()
    else:
        return url
531514
private String getHostHeaderForHost(String hostName) {
        List<ServerRedirect> servers = serverRedirectService.tableServers(requestInformation.get().client.getId());
        for (ServerRedirect server : servers) {
            if (server.getSrcUrl().compareTo(hostName) == 0) {
                String hostHeader = server.getHostHeader();
                if (hostHeader == null || hostHeader.length() == 0) {
                    return null;
                }
                return hostHeader;
            }
        }
        return null;
    }
1210950
def get_vhost_permissions(self, vname):
        
        vname = quote(vname, '')
        path = Client.urls['vhost_permissions_get'] % (vname,)
        conns = self._call(path, 'GET')
        return conns
621301
def get_vhosts(ip, first=1, no_cache=False):
    

    if not no_cache:
        homedir = pwd.getpwuid(os.getuid()).pw_dir
        requests_cache.install_cache(homedir + '/.habu_requests_cache')

    url = "http://www.bing.com/search?q=ip:{ip}&first={first}".format(ip=ip, first=first)

    response = requests.get(url)

    soup = BeautifulSoup(response.text, "html.parser")

    vhosts = set()

    for h2 in soup.find_all('h2'):
        for link in h2.find_all('a'):
            href = link.get('href')

            if href.startswith('http://') or href.startswith('https://'):
                vhost = href.split('/')[2]
                vhosts.add(vhost)

    return list(vhosts)
343055
def get_host(self, name, default=NoHostError):
        '''
        
        '''

        if name in self.hosts:
            return self.hosts[name]

        if default is NoHostError:
            raise NoHostError('No such host: {0}'.format(name))

        return default
489951
def getHosts(filename=None, hostlist=None):
    """"""
    if filename:
        return getHostsFromFile(filename)
    elif hostlist:
        return getHostsFromList(hostlist)
    elif getEnv() == "SLURM":
        return getHostsFromSLURM()
    elif getEnv() == "PBS":
        return getHostsFromPBS()
    elif getEnv() == "SGE":
        return getHostsFromSGE()
    else:
        return getDefaultHosts()
1038795
def list_hosts():
    ''''''
    with Session() as session:
        try:
            resp = session.VFolder.list_hosts()
            print(f"Default vfolder host: {resp['default']}")
            print(f"Usable hosts: {', '.join(resp['allowed'])}")
        except Exception as e:
            print_error(e)
            sys.exit(1)
585648
def host_url(self):
        
        return get_current_url(
            self.environ, host_only=True, trusted_hosts=self.trusted_hosts
        )
732301
def servers(self):
        """"""
        url = "%s/servers" % self.root
        return Servers(url=url,
                       securityHandler=self._securityHandler,
                       proxy_url=self._proxy_url,
                       proxy_port=self._proxy_port)
1030177
private String chooseHost(String[] dbHosts) {
        String host = null;
        synchronized (m_lastHostLock) {
            if (dbHosts.length == 1) {
                host = dbHosts[0];
            } else if (!Utils.isEmpty(m_lastHost)) {
                for (int index = 0; host == null && index < dbHosts.length; index++) {
                    if (dbHosts[index].equals(m_lastHost)) {
                        host = dbHosts[(++index) % dbHosts.length];
                    }
                }
            }
            if (host == null) {
                host = dbHosts[new Random().nextInt(dbHosts.length)];
            }
            m_lastHost = host;
        }
        return host;
    }
1082037
@Override
    public List<String> getVirtualHosts() {
        if (null == this.vhostArray) {
            // nothing here but the api says it returns a non-null empty list
            this.vhostArray = new ArrayList<String>(0);
        }
        return this.vhostArray;
    }
681099
def list_policies_for_vhost(self, vhost):
        
        return self._api_get('/api/policies/{0}'.format(
            urllib.parse.quote_plus(vhost)
        ))