Get all subdomain operations processed in a given transaction.
        Returns the list of subdomains on success (can be empty)
        Returns 502 on failure to get subdomains
545193
def GET_subdomain_ops(self, path_info, txid):
        
        blockstackd_url = get_blockstackd_url()
        subdomain_ops = None
        try:
            subdomain_ops = blockstackd_client.get_subdomain_ops_at_txid(txid, hostport=blockstackd_url)
        except ValueError:
            return self._reply_json({'error': 'Invalid argument: not a well-formed txid'}, status_code=400)

        if json_is_error(subdomain_ops):
            log.error('Failed to get subdomain operations at {}: {}'.format(txid, subdomain_ops['error']))
            return self._reply_json({'error': 'Failed to get subdomain operations'}, status_code=subdomain_ops.get('http_status', 500))

        return self._reply_json(subdomain_ops)
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}
1112970
def get_subdomains_count(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)
    return db.get_subdomains_count()
861219
def list_domains(self):
        
        self.connect()
        results = self.server.list_domains(self.session_id)
        return {i['domain']: i['subdomains'] for i in results}
1292851
def get_bank_transaction(bank_transaction_id)
      request_params = {}
      url = "#{@xero_url}/BankTransactions/#{CGI.escape(bank_transaction_id)}"
      response_xml = http_get(@client, url, request_params)
      parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/BankTransaction'})
    end
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)
387369
def all(cls, domain=None):
        
        Site = cls
        site = Session.query(Site)
        if domain:
            site.filter(Site.domain == domain)
        return site.all()
715407
def get_bank_transactions(options = {})
      request_params = {}
      request_params[:BankTransactionID]  = options[:bank_transaction_id] if options[:bank_transaction_id]
      request_params[:ModifiedAfter]      = options[:modified_since] if options[:modified_since]
      request_params[:order]              = options[:order] if options[:order]
      request_params[:where]              = options[:where] if options[:where]
      request_params[:page]               = options[:page] if options[:page]

      response_xml = http_get(@client, "#{@xero_url}/BankTransactions", request_params)

      parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/BankTransactions'})
    end
1351979
def get_domains(self):
        
        # Domains are fixed and actually only one per REST api.
        if self._domains is None:
            self._domains = self._get_elements('domains', Domain)
        return self._domains
1058103
def get_blockstack_transactions_at(block_id, proxy=None, hostport=None):
    
    assert proxy or hostport, 'Need proxy or hostport'
    if proxy is None:
        proxy = connect_hostport(hostport)

    history_schema = {
        'type': 'array',
        'items': {
            'type': 'object',
            'properties': OP_HISTORY_SCHEMA['properties'],
            'required': [
                'op',
                'opcode',
                'txid',
                'vtxindex',
            ]
        }
    }

    nameop_history_schema = {
        'type': 'object',
        'properties': {
            'nameops': history_schema,
        },
        'required': [
            'nameops',
        ],
    }

    history_count_schema = {
        'type': 'object',
        'properties': {
            'count': {
                'type': 'integer',
                'minimum': 0,
            },
        },
        'required': [
            'count',
        ],
    }
    
    count_schema = json_response_schema( history_count_schema )
    nameop_schema = json_response_schema( nameop_history_schema )

    # how many nameops?
    num_nameops = None
    try:
        num_nameops = proxy.get_num_blockstack_ops_at(block_id)
        num_nameops = json_validate(count_schema, num_nameops)
        if json_is_error(num_nameops):
            return num_nameops

    except ValidationError as e:
        if BLOCKSTACK_DEBUG:
            log.exception(e)

        resp = {'error': 'Server response did not match expected schema.  You are likely communicating with an out-of-date Blockstack node.', 'http_status': 502}
        return resp

    except socket.timeout:
        log.error("Connection timed out")
        resp = {'error': 'Connection to remote host timed out.', 'http_status': 503}
        return resp

    except socket.error as se:
        log.error("Connection error {}".format(se.errno))
        resp = {'error': 'Connection to remote host failed.', 'http_status': 502}
        return resp

    except Exception as ee:
        if BLOCKSTACK_DEBUG:
            log.exception(ee)

        log.error("Caught exception while connecting to Blockstack node: {}".format(ee))
        resp = {'error': 'Failed to contact Blockstack node.  Try again with `--debug`.', 'http_status': 500}
        return resp

    num_nameops = num_nameops['count']

    # grab at most 10 of these at a time
    all_nameops = []
    page_size = 10
    while len(all_nameops) < num_nameops:
        resp = {}
        try:
            resp = proxy.get_blockstack_ops_at(block_id, len(all_nameops), page_size)
            resp = json_validate(nameop_schema, resp)
            if json_is_error(resp):
                return resp

            if len(resp['nameops']) == 0:
                return {'error': 'Got zero-length nameops reply', 'http_status': 503}

            all_nameops += resp['nameops']

        except ValidationError as e:
            if BLOCKSTACK_DEBUG:
                log.exception(e)

            resp = {'error': 'Server response did not match expected schema.  You are likely communicating with an out-of-date Blockstack node.', 'http_status': 502}
            return resp

        except socket.timeout:
            log.error("Connection timed out")
            resp = {'error': 'Connection to remote host timed out.', 'http_status': 503}
            return resp

        except socket.error as se:
            log.error("Connection error {}".format(se.errno))
            resp = {'error': 'Connection to remote host failed.', 'http_status': 502}
            return resp

        except Exception as ee:
            if BLOCKSTACK_DEBUG:
                log.exception(ee)

            log.error("Caught exception while connecting to Blockstack node: {}".format(ee))
            resp = {'error': 'Failed to contact Blockstack node.  Try again with `--debug`.', 'http_status': 500}
            return resp

    return all_nameops
847382
def operations(self):
        
        return [op for block in self.blocks for op in block.vex.operations]
1032433
def get_block_transactions(
            self,
            header: BlockHeader,
            transaction_class: Type['BaseTransaction']) -> Iterable['BaseTransaction']:
        
        return self._get_block_transactions(header.transaction_root, transaction_class)
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)
1263789
def get_transactions(cls, address):
        

        for api_call in cls.GET_TRANSACTIONS_MAIN:
            try:
                return api_call(address)
            except cls.IGNORED_ERRORS:
                pass

        raise ConnectionError('All APIs are unreachable.')
539758
def rpc_get_all_subdomains( self, offset, count, **conf_info):
        
        if not check_offset(offset):
            return {'error': 'invalid offset', 'http_status': 400}

        if not check_count(count, 100):
            return {'error': 'invalid count', 'http_status': 400}

        all_subdomains = get_all_subdomains(offset = offset,
                                            count = count)

        return self.success_response( {'names': all_subdomains} )
403235
def get_subdomain(url):
        
        allowed_domain = UrlExtractor.get_allowed_domain(url)
        return allowed_domain[:len(allowed_domain) - len(
            UrlExtractor.get_allowed_domain(url, False))]
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']