Try to find a hive for the given domain; raise an error if we have to
        failover to HTTP and haven't explicitly suppressed it in the call.
353940
def from_domain(cls, domain, version=None, require_https=True):
        
        url = 'https://' + domain + '/api/hive.json'
        try:
            return cls.from_url(url, version=version, require_https=require_https)
        except MissingHive:
            url = 'http://' + domain + '/api/hive.json'
            return cls.from_url(url, version=version, require_https=require_https)
321364
def process_request(self, request):
        
        domain, host = map(lower,
            (self.get_domain_for_request(request), request.get_host()))

        pattern = r'^(?:(?P<subdomain>.*?)\.)?%s(?::.*)?$' % re.escape(domain)
        matches = re.match(pattern, host)

        if matches:
            request.subdomain = matches.group('subdomain')
        else:
            request.subdomain = None
            logger.warning('The host %s does not belong to the domain %s, '
                'unable to identify the subdomain for this request',
                request.get_host(), domain)
147798
def _maybe_registered(self, failure, new_reg):
        
        failure.trap(ServerError)
        response = failure.value.response
        if response.code == http.CONFLICT:
            reg = new_reg.update(
                resource=messages.UpdateRegistration.resource_type)
            uri = self._maybe_location(response)
            return self.update_registration(reg, uri=uri)
        return failure
300649
public function lookupDomain($domain)
    {
        $serverObj = new Server();
        $server = $serverObj->getServerByTld($this->tld);
        if (!$server) {
            throw new Exception("Error: No appropriate Whois server found for $domain domain!");
        }
        $result = $this->queryServer($server, $domain);
        if (!$result) {
            throw new Exception("Error: No results retrieved from $server server for $domain domain!");
        } else {
            while (strpos($result, "Whois Server:") !== false) {
                preg_match("/Whois Server: (.*)/", $result, $matches);
                $secondary = $matches[1];
                if ($secondary) {
                    $result = $this->queryServer($secondary, $domain);
                    $server = $secondary;
                }
            }
        }
        return "$domain domain lookup results from $server server:\n\n" . $result;
    }
800000
def domain(self):
        
        remove_pac = self.cleanup.replace(
            "https://", "").replace("http://", "").replace("www.", "")
        try:
            return remove_pac.split('/')[0]
        except:
            return None
14381
def FqdnUrl(v):
    
    try:
        parsed_url = _url_validation(v)
        if "." not in parsed_url.netloc:
            raise UrlInvalid("must have a domain name in URL")
        return v
    except:
        raise ValueError
650627
def get_host_system_failfast(
            self,
            name,
            verbose=False,
            host_system_term='HS'
    ):
        
        if verbose:
            print("Finding HostSystem named %s..." % name)

        hs = self.get_host_system(name)

        if hs is None:
            print("Error: %s '%s' does not exist" % (host_system_term, name))
            sys.exit(1)

        if verbose:
            print("Found HostSystem: {0} Name: {1}" % (hs, hs.name))

        return hs
880401
function extractDomain (url) {
  // Find and remove protocol (e.g., http, ftp, etc.) to get domain.
  var domain = url.indexOf('://') > -1 ? url.split('/')[2] : url.split('/')[0];

  // Find and remove port number.
  return domain.substring(0, domain.indexOf(':'));
}
666280
def extract_domain(host):
    
    host = re.sub('https?://', '', host)
    host = re.match('([^/]+)', host).groups()[0]
    domain = '.'.join(host.split('.')[-2:])
    if domain in _domains:
        domain = '.'.join(host.split('.')[-3:])
    return domain
1036841
def _domain_event_io_error_cb(conn, domain, srcpath, devalias, action, reason, opaque):
    '''
    
    '''
    _salt_send_domain_event(opaque, conn, domain, opaque['event'], {
        'srcPath': srcpath,
        'dev': devalias,
        'action': _get_libvirt_enum_string('VIR_DOMAIN_EVENT_IO_ERROR_', action),
        'reason': reason
    })
330849
def _retry_get(self, uri):
        
        for i in six.moves.range(DEFAULT_RETRY):
            resp, body = self.api.method_get(uri)
            if body:
                return resp, body
        # Tried too many times
        raise exc.ServiceResponseFailure("The Cloud DNS service failed to "
                "respond to the request.")
1178983
def domain_error!(first, *args)
      first = [first]+args unless args.empty?
      raise TypeError, "Can't convert `#{first.inspect}` into #{self}", caller
    end
1106139
def check_domain(self, service_id, version_number, name):
		""""""
		content = self._fetch("/service/%s/version/%d/domain/%s/check" % (service_id, version_number, name))
		return FastlyDomainCheck(self, content)
136889
def head_bucket(self, name):
        
        try:
            self.s3.head_bucket(Bucket=name)
            info = self.s3.get_bucket_website(Bucket=self.sitename)
            if not info:
                return False, 404, "Configure improrperly"
            return True, None, None
        except botocore.exceptions.ClientError as e:
            if e.response["Error"]["Code"] in ["403", "404"]:
                return False, e.response["Error"]["Code"], e.response["Error"]["Message"]
            else:
                raise e
1012610
void doMain(String[] args, boolean throwOnError) throws Exception {
		if (args.length == 0) {
			usage(throwOnError, "no arguments specified");
			return;
		} else if (args.length > 2) {
			usage(throwOnError, "improper number of arguments:" + Arrays.toString(args));
			return;
		}

		// check for --usage or --help
		if (args.length == 1 && ("--usage".equals(args[0]) || "--help".equals(args[0]))) {
			usage(throwOnError, null);
			return;
		}

		CommandLineJmxClient jmxClient;
		if (args[0].indexOf('/') >= 0) {
			jmxClient = new CommandLineJmxClient(args[0]);
		} else {
			String[] parts = args[0].split(":");
			if (parts.length != 2) {
				usage(throwOnError, "argument should be in 'hostname:port' format, not: " + args[0]);
				return;
			}
			String hostName = parts[0];
			int port = 0;
			try {
				port = Integer.parseInt(parts[1]);
			} catch (NumberFormatException e) {
				usage(throwOnError, "port number not in the right format: " + parts[1]);
				return;
			}
			jmxClient = new CommandLineJmxClient(hostName, port);
		}

		if (args.length == 1) {
			jmxClient.runCommandLine();
		} else if (args.length == 2) {
			jmxClient.runBatchFile(new File(args[1]));
		}
	}
1281514
public static dnssoarec get(nitro_service service, String domain) throws Exception{
		dnssoarec obj = new dnssoarec();
		obj.set_domain(domain);
		dnssoarec response = (dnssoarec) obj.get_resource(service);
		return response;
	}
75847
def subdomain_check_pending(self, subrec, atlasdb_path, cur=None):
        
        _, _, domain = is_address_subdomain(subrec.get_fqn())
        sql = 'SELECT missing FROM {} WHERE domain = ? ORDER BY parent_zonefile_index DESC LIMIT 1;'.format(self.subdomain_table)
        args = (domain,)

        cursor = None
        if cur is None:
            cursor = self.conn.cursor()
        else:
            cursor= cur

        rows = db_query_execute(cursor, sql, args)
        missing_str = ""
        try:
            rowdata = rows.fetchone()
            assert rowdata
            missing_str = rowdata['missing']
        except:
            pass

        known_missing = [int(i) for i in missing_str.split(',')] if missing_str is not None and len(missing_str) > 0 else []
        num_missing = atlasdb_get_zonefiles_missing_count_by_name(domain, indexes_exclude=known_missing, path=atlasdb_path)
        if num_missing > 0:
            log.debug("Subdomain is missing {} zone files: {}".format(num_missing, subrec))

        return num_missing > 0