GET /static_blocks
 GET /static_blocks.json
190594
def index
      @search = Snippet.order('title asc').search(params[:q])
      @snippets = @search.result(distinct: true).per_page_kaminari(params[:page]).per(10)

      respond_to do |format|
        format.html # index.html.erb
        format.json { render json: @snippets }
      end
    end
287570
def GET_zonefile(self, path_info, zonefile_hash):
        
        if not check_string(zonefile_hash, pattern=OP_ZONEFILE_HASH_PATTERN):
            return self._reply_json({'error': 'Invalid zone file hash'}, status_code=400)

        blockstackd_url = get_blockstackd_url()
        resp = blockstackd_client.get_zonefiles(blockstackd_url, [str(zonefile_hash)])
        if json_is_error(resp):
            log.error("Failed to get {}: {}".format(zonefile_hash, resp['error']))
            return self._reply_json({'error': resp['error']}, status_code=resp.get('http_status', 502))

        if str(zonefile_hash) not in resp['zonefiles']:
            return self._reply_json({'error': 'Blockstack node does not have this zonefile.  Try again later.'}, status_code=404)

        self._send_headers(status_code=200, content_type='application/octet-stream')
        self.wfile.write(resp['zonefiles'][str(zonefile_hash)])
        return
717340
def get_block_info(self):
        
        if not self.finished:
            raise Exception("Not finished downloading")

        ret = []
        for (block_hash, block_data) in self.block_info.items():
            ret.append( (block_data['height'], block_data['txns']) )

        return ret
330021
def retrieve_static_files(dir, dot_static_files)
      theme_static_files = []
      dot_static_files.each do |file|
        theme_static_files << StaticFile.new(@site, dir, "/", file)
      end
      site.static_files.concat(theme_static_files)
    end
1279191
def get_scheduling_block_event():
    """"""
    event = DB.rpoplpush('scheduling_block_events',
                         'scheduling_block_event_history')
    if event:
        event = json.loads(event.decode('utf-8'))
    return event
1172814
def getJson(cls, url, method='GET', headers={}, data=None, socket=None, timeout=120):
        
        if not 'Content-Type' in headers:
            headers['Content-Type'] = ['application/json']

        body = yield cls().getBody(url, method, headers, data, socket, timeout)

        defer.returnValue(json.loads(body))
156059
public function get_installed_blocks() {
        global $DB;
        if (is_null($this->allblocks)) {
            $this->allblocks = $DB->get_records('block');
        }
        return $this->allblocks;
    }
736232
async def blocks(client: Client, pubkey: str, start: int, end: int) -> dict:
    
    return await client.get(MODULE + '/history/%s/blocks/%s/%s' % (pubkey, start, end), schema=HISTORY_SCHEMA)
1145490
def _get_block(self):
    """"""
    b = self._fh.read(4) # get block size bytes
    #print self._fh.tell()
    if not b: raise StopIteration
    block_size = struct.unpack('<i',b)[0]
    return self._fh.read(block_size)
534352
function getBlock() {
  const type = NodeType.BlockType;
  const token = tokens[pos];
  const line = token.ln;
  const column = token.col;
  const end = tokens[pos].right;
  let content = [];

  // Skip `{`.
  pos++;

  while (pos < end) {
    if (checkBlockdecl(pos)) content = content.concat(getBlockdecl());
    else throwError(pos);
  }

  const end_ = getLastPosition(content, line, column, 1);
  pos = end + 1;

  return newNode(type, content, line, column, end_);
}
799158
def block_before(self):
        
        # To avoid unnecessary database queries, ignore the IP check for
        # requests for static files
        if request.path.startswith(url_for('static', filename='')):
            return

        # Some static files might be served from the root path (e.g.
        # favicon.ico, robots.txt, etc.). Ignore the IP check for most
        # common extensions of those files.
        ignored_extensions = ('ico', 'png', 'txt', 'xml')
        if request.path.rsplit('.', 1)[-1] in ignored_extensions:
            return

        ips = request.headers.getlist('X-Forwarded-For')
        if not ips:
            return

        # If the X-Forwarded-For header contains multiple comma-separated
        # IP addresses, we're only interested in the last one.
        ip = ips[0].strip()
        if ip[-1] == ',':
            ip = ip[:-1]
        ip = ip.rsplit(',', 1)[-1].strip()

        if self.matches_ip(ip):
            if self.logger is not None:
                self.logger.info("IPBlock: matched {}, {}".format(ip, self.block_msg))
            if self.blocking_enabled:
                return 'IP Blocked', 200
65582
def json(self):
        '''  '''
        if 'application/json' in self.environ.get('CONTENT_TYPE', '') \
        and 0 < self.content_length < self.MEMFILE_MAX:
            return json_loads(self.body.read(self.MEMFILE_MAX))
        return None
847324
def list_blocks(self):
        
        logger.debug("listing blocks")
        blocksList = BlocksList()
        result = self.library.Cli_ListBlocks(self.pointer, byref(blocksList))
        check_error(result, context="client")
        logger.debug("blocks: %s" % blocksList)
        return blocksList
347710
def get_blocks(self, chrom, start, end):
    
    blocks = []
    for k in self.__get_keys(chrom, start, end):
      self.__switch_alig(k)
      blocks += self.current.get_blocks(chrom, start, end)
    return blocks
262059
def getblock(self, blockhash, decode=False):
        """"""

        if not decode:
            decode = "false"

            return self.req("getblock", [blockhash, decode])

        else:
            return self.req("getblock", [blockhash])
689308
def get_block_height(height, api_code=None):
    

    resource = 'block-height/{0}?format=json'.format(height)
    if api_code is not None:
        resource += '&api_code=' + api_code
    response = util.call_api(resource)
    json_response = json.loads(response)
    return [Block(b) for b in json_response['blocks']]
457848
def __read_api_project(self):
        

        file_name = join(self.app.static_folder, self.folder_path, 'api_project.json')

        with open(file_name, 'rt') as file:
            data = file.read()

        return json.loads(data)