Get a subdomain's DID info.
    Return None if not found
439626
def get_subdomain_DID_info(fqn, db_path=None, zonefiles_dir=None):
    
    opts = get_blockstack_opts()
    if not is_subdomains_enabled(opts):
        log.warn("Subdomain support is disabled")
        return None

    if db_path is None:
        db_path = opts['subdomaindb_path']

    if zonefiles_dir is None:
        zonefiles_dir = opts['zonefiles']

    db = SubdomainDB(db_path, zonefiles_dir)
    try:
        subrec = db.get_subdomain_entry(fqn)
    except SubdomainNotFound:
        log.warn("No such subdomain: {}".format(fqn))
        return None
    
    try:
        return db.get_subdomain_DID_info(fqn)
    except SubdomainNotFound:
        return None
327762
def get_domains(custom_headers:nil)
      response = get_domains_async(custom_headers:custom_headers).value!
      response.body unless response.nil?
    end
234679
def getRequestedNameIface(self, iface_num=0, num=None, default_hostname=None, default_domain=None):
        """"""

        full_name = self.getValue("net_interface.%d.dns_name" % iface_num)

        if full_name:
            replaced_full_name = system.replaceTemplateName(full_name, num)
            (hostname, domain) = replaced_full_name
            if not domain:
                domain = default_domain
            return (hostname, domain)
        else:
            if default_hostname:
                (hostname, _) = system.replaceTemplateName(default_hostname, num)
                return (hostname, default_domain)
            else:
                return None
106328
def get_join_info():
    '''
    
    '''
    info = win32net.NetGetJoinInformation()
    status = {win32netcon.NetSetupUnknown: 'Unknown',
              win32netcon.NetSetupUnjoined: 'Unjoined',
              win32netcon.NetSetupWorkgroupName: 'Workgroup',
              win32netcon.NetSetupDomainName: 'Domain'}
    return {'Domain': info[0],
            'DomainType': status[info[1]]}
803757
def subdomain(self, domain, depth):
        
        p = self.privateparts(domain)
        if p is None or depth > len(p) - 1:
            return None
        else:
            return ".".join(p[-(depth+1):])
267651
def rpc_get_name_record(self, name, **con_info):
        
        res = None
        if check_name(name):
            res = self.get_name_record(name, include_expired=True, include_history=False)
        elif check_subdomain(name):
            res = self.get_subdomain_record(name, include_history=False)
        else:
            return {'error': 'Invalid name or subdomain', 'http_status': 400}

        if 'error' in res:
            return {'error': res['error'], 'http_status': 404}

        # also get a DID
        did_info = None
        did = None
        if check_name(name):
            did_info = self.get_name_DID_info(name)
        elif check_subdomain(name):
            did_info = self.get_subdomain_DID_info(name)
        else:
            return {'error': 'Invalid name or subdomain', 'http_status': 400}

        if did_info is not None:
            did = make_DID(did_info['name_type'], did_info['address'], did_info['index'])
            res['record']['did'] = did

        return self.success_response({'record': res['record']})
1179957
def get_all_subdomains(offset=None, count=None, min_sequence=None, db_path=None, zonefiles_dir=None):
    
    opts = get_blockstack_opts()
    if not is_subdomains_enabled(opts):
        return []

    if db_path is None:
        db_path = opts['subdomaindb_path']

    if zonefiles_dir is None:
        zonefiles_dir = opts['zonefiles']

    db = SubdomainDB(db_path, zonefiles_dir)
    return db.get_all_subdomains(offset=offset, count=count, min_sequence=None)
1038394
def get_subdomain_entry(self, fqn, accepted=True, cur=None):
        
        get_cmd = "SELECT * FROM {} WHERE fully_qualified_subdomain=? {} ORDER BY sequence DESC, parent_zonefile_index DESC LIMIT 1;".format(self.subdomain_table, 'AND accepted=1' if accepted else '')
        cursor = None
        if cur is None:
            cursor = self.conn.cursor()
        else:
            cursor = cur

        db_query_execute(cursor, get_cmd, (fqn,))

        try:
            rowdata = cursor.fetchone()
            assert rowdata
        except Exception as e:
            raise SubdomainNotFound(fqn)

        return self._extract_subdomain(rowdata)
913824
def domain_informations(domain, options={})
      response = connection.get do |req|
        req.url "insight/domains/#{domain}", options
      end
      return_error_or_body(response)
    end
1330547
def get_my_info():
    
    result = {}
    result['host_name'] = platform.node()
    result['real_host_name'] = platform.node()
    result['dist'] = platform.dist()
    result['nago_version'] = nago.get_version()
    return result
891340
def get_subdomain_history(fqn, offset=None, count=None, reverse=False, db_path=None, zonefiles_dir=None, json=False):
    
    opts = get_blockstack_opts()
    if not is_subdomains_enabled(opts):
        return []

    if db_path is None:
        db_path = opts['subdomaindb_path']
    
    if zonefiles_dir is None:
        zonefiles_dir = opts['zonefiles']

    db = SubdomainDB(db_path, zonefiles_dir)
    recs = db.get_subdomain_history(fqn, offset=offset, count=count)

    if json:
        recs = [rec.to_json() for rec in recs]
        ret = {}
        for rec in recs:
            if rec['block_number'] not in ret:
                ret[rec['block_number']] = []

            ret[rec['block_number']].append(rec)

        if reverse:
            for block_height in ret:
                ret[block_height].sort(lambda r1, r2: -1 if r1['parent_zonefile_index'] > r2['parent_zonefile_index'] or 
                                                           (r1['parent_zonefile_index'] == r2['parent_zonefile_index'] and r1['zonefile_offset'] > r2['zonefile_offset']) else
                                                       1 if r1['parent_zonefile_index'] < r2['parent_zonefile_index'] or 
                                                           (r1['parent_zonefile_index'] == r2['parent_zonefile_index'] and r1['zonefile_offset'] < r2['zonefile_offset']) else
                                                       0)
        return ret

    else:
        return recs
938398
def lookup_domain(domain, nameservers=[], rtype="A",
                  exclude_nameservers=[], timeout=2):
    """"""
    dns_exp = DNSQuery(domains=[domain], nameservers=nameservers, rtype=rtype,
                       exclude_nameservers=exclude_nameservers, timeout=timeout)
    return dns_exp.lookup_domain(domain)
954536
def get_allowed_domain(url, allow_subdomains=True):
        
        if allow_subdomains:
            return re.sub(re_www, '', re.search(r'[^/]+\.[^/]+', url).group(0))
        else:
            return re.search(re_domain, UrlExtractor.get_allowed_domain(url)).group(0)
1371265
def _is_did(did):
    
    return d1_gmn.app.models.IdNamespace.objects.filter(did=did).exists()
201592
def get_domain_resolver(self, domain_name, cur=None):
        
        get_cmd = "SELECT resolver FROM {} WHERE domain=? AND resolver != '' AND accepted=1 ORDER BY sequence DESC, parent_zonefile_index DESC LIMIT 1;".format(self.subdomain_table)

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

        db_query_execute(cursor, get_cmd, (domain_name,))

        rowdata = cursor.fetchone()
        if not rowdata:
            return None

        return rowdata['resolver']
1206190
def get_subdomain_record(self, fqn, include_history=False):
        
        if not check_subdomain(fqn):
            return {'error': 'invalid subdomain', 'http_status': 400}
        
        fqn = str(fqn)

        # get current record
        subdomain_rec = get_subdomain_info(fqn, check_pending=True)
        if subdomain_rec is None:
            return {'error': 'Failed to load subdomain', 'http_status': 404}
   
        ret = subdomain_rec.to_json()
        if include_history:
            subdomain_hist = get_subdomain_history(fqn, json=True)
            ret['history'] = subdomain_hist

        return {'status': True, 'record': ret}
1373240
def _extract_subdomain(host):
        
        host = host.split(':')[0]
        # If the host is an IP address, there is no subdomain to extract
        try:
            # Check if the host is an ip address
            socket.inet_aton(host)
        except socket.error:
            # It isn't an IP address, return the subdomain
            return '.'.join(host.split('.')[:-2])