Callback for "page-get" command
434596
public function cmdGetPage()
    {
        $result = $this->getListPage();
        $this->outputFormat($result);
        $this->outputFormatTablePage($result);
        $this->output();
    }
487866
def dispatch_request(self, environ, start_response):
        """"""
        # set up all the stuff we want to have for this request.  That is
        # creating a request object, propagating the application to the
        # current context and instanciating the database session.
        self.bind_to_context()
        request = Request(environ)
        request.bind_to_context()

        # get the current action from the url and normalize the page name
        # which is just the request path
        action_name = request.args.get("action") or "show"
        page_name = u"_".join([x for x in request.path.strip("/").split() if x])

        # redirect to the Main_Page if the user requested the index
        if not page_name:
            response = redirect(href("Main_Page"))

        # check special pages
        elif page_name.startswith("Special:"):
            if page_name[8:] not in pages:
                response = page_not_found(request, page_name)
            else:
                response = pages[page_name[8:]](request)

        # get the callback function for the requested action from the
        # action module.  It's "on_" + the action name.  If it doesn't
        # exists call the missing_action method from the same module.
        else:
            action = getattr(actions, "on_" + action_name, None)
            if action is None:
                response = actions.missing_action(request, action_name)
            else:
                response = action(request, page_name)

        # make sure the session is removed properly
        return ClosingIterator(response(environ, start_response), session.remove)
665045
function ajaxCallback(page, ph, oldUrl, options, callback) {
    // callback for page change
    switch(options) {
        case 1:
            // expect ajax
            pageDomHasChanged(page, ph, function (error, page, ph) {
                callback(error, page, ph);
            });
            break;
        case 2:
            // expect navigation
            pageHasChanged(page, oldUrl, function (error) {
                callback(error, page, ph);
            });
            break;
        default:
            // callback immediately
            callback(null, page, ph);
            break;
    }
}
911933
function getNextPage() {
    var send_object = {
        "results":  {},
        "numMatches": 0,
        "foundMaximum":  foundMaximum,
        "exceedsMaximum":  exceedsMaximum
    };
    if (!savedSearchObject) {
        return send_object;
    }
    savedSearchObject.startFileIndex = lastSearchedIndex;
    return doSearch(savedSearchObject, true);
}
859139
def get_paged_request(url, headers=None, **params):
    """"""
    results = []
    params.setdefault("per_page", 100)
    while True:
        if '?' in url:
            params = None
            print("fetching %s" % url, file=sys.stderr)
        else:
            print("fetching %s with %s" % (url, params), file=sys.stderr)
        response = requests.get(url, headers=headers, params=params)
        response.raise_for_status()
        results.extend(response.json())
        if 'next' in response.links:
            url = response.links['next']['url']
        else:
            break
    return results
482102
def print_help(self, *args, **kwargs):
        
        if self._command is not None and self._command.session.allow_pager:
            desc = 'Help\: %s' % '-'.join(self.prog.split())
            pager_kwargs = self._command.get_pager_spec()
            with paging.pager_redirect(desc, **pager_kwargs):
                return super().print_help(*args, **kwargs)
        else:
                return super().print_help(*args, **kwargs)
678285
function findPage(pages, path) {
  const p = path.shift();
  const page = pages.find(page => page.path === p);

  if (!page) {
    return {redirect: getDefaultPath(pages)};
  }
  if (page.children) {
    const result = findPage(page.children, path);
    if (result.page) {
      return result;
    }
    return {redirect: [p].concat(result.redirect)};
  }
  if (path.length) {
    return {redirect: []};
  }
  return {page};
}
201601
def find(command, on):
    """"""
    output_lines = parse_man_page(command, on)
    click.echo(''.join(output_lines))
824025
function callPageHook(name, output, page) {
    return callHook(
        name,

        function(out) {
            return Api.encodePage(out, page);
        },

        function(out, result) {
            return Api.decodePage(out, page, result);
        },

        output
    );
}
407856
def prompt(pagenum):
    
    prompt = "Page -%s-. Press any key to continue . . . " % pagenum
    echo(prompt)
    if getch() in [ESC_, CTRL_C_, 'q', 'Q']:
        return False
    echo('\r' + ' '*(len(prompt)-1) + '\r')
589963
def _iterate_through_pages(get_function, resource, **kwargs):
        

        request_data = True
        data = []
        page = 1

        while request_data:
            temp_response = get_function(page=page, **kwargs)
            if temp_response[resource]['@total'] != '0':
                data.append(temp_response)

            page += 1
            if page > int(
                math.ceil(
                    float(temp_response[resource]['@total']) / float(temp_response[resource]['@per_page'])
                )
            ):
                request_data = False
        return data
1053457
async function getPage(file) {
  config = config || (await asyncConfig());
  if (config.verbosity > 3) {
    log.dim(`Getting info for: ${file}`);
  }

  const url = path
    .relative(config.srcDir, file)
    .replace('.md', '.html')
    .split('/')
    .map(x => x.replace(/^[0-9]*-/, '')) // Removing number prefix `05-item` => `item`
    .join('/');
  const fileContents = await readFile(file, 'utf8');

  // https://www.npmjs.com/package/front-matter
  const { attributes, body, frontmatter } = fm(fileContents);

  const dirTree = url.split('/');

  let depth = url.split('/').filter(x => x !== 'index.html').length;

  let parent = dirTree[depth - 2];

  // Don't do it for homepage
  if (url === 'index.html') depth = 1;

  const page = {
    srcPath: file,
    url,
    depth,
    parent,
    meta: attributes,
    body: file.endsWith('.md') ? marked(body) : body,
  };

  return page;
}
493715
function(callback){
    var options = this.options,
        cache = this.options.cache,
        logger =  this.options.logger;


    if(this.url){
      logger.log('fetch page: ' + this.url);

      // if there is a cache and it holds the url
      if(cache &&cache.has(this.url)){
        // http status - content located elsewhere, retrieve from there
        this.statusCode = 305;
        this.requestTime = 0;
        this.html = cache.get(this.url);
        logger.log('fetched html from cache: ' + this.url);

        this.parse(function(){
          callback(this);
        })

      // if not get the html from the url  
      }else{

        this.startedRequest = new Date();
        var self = this;

        var requestObj = {
          uri: this.url,
          headers: options.httpHeaders
        }

        request(requestObj, function(requestErrors, response, body){
          if(!requestErrors && response.statusCode === 200){

            self.endedRequest = new Date();
            self.requestTime = self.endedRequest.getTime() - self.startedRequest.getTime();
            logger.log('fetched html from page: ' 
              + self.requestTime + 'ms - ' + self.url);
            
            self.statusCode = response.statusCode;
            self.html = body;

            if(cache){
              cache.set(self.url, body);
            }

            self.parse(function(){
              self.status = "fetched";
              callback(self);
            })

          }else{
            logger.warn('error requesting page: ' + self.url);
            self.error = 'error requesting page: ' + self.url;
            self.status = "errored";
            callback();
          }
        });


      }
    }else{
      logger.warn('no url given');
      this.error = 'no url given';
      this.status = "errored";
      callback();
    }
  }
1265259
function echo(req, res) {
    // TODO: headers... and so on...
    return res.json({
        method: req.method,
        path: req.baseUrl + req.path,
        query: req.query,
        body: req.body
    });
}
319550
def _fetch_page_async(self, page_size, **q_options):
    """"""
    q_options.setdefault('batch_size', page_size)
    q_options.setdefault('produce_cursors', True)
    it = self.iter(limit=page_size + 1, **q_options)
    results = []
    while (yield it.has_next_async()):
      results.append(it.next())
      if len(results) >= page_size:
        break
    try:
      cursor = it.cursor_after()
    except datastore_errors.BadArgumentError:
      cursor = None
    raise tasklets.Return(results, cursor, it.probably_has_next())
294827
def get_page(self, paginator):
        """"""
        page = int(self.get_and_save_value('page', 1))
        if page < 1:
            return self.save_value('page', 1)

        if page > paginator.num_pages:
            return self.save_value('page', paginator.num_pages)
        return page
144601
def _paged_api_call(self, func, kwargs, item_type='photo'):
        
        page = 1
        while True:
            LOG.info("Fetching page %s" % page)
            kwargs['page'] = page
            rsp = self._load_rsp(func(**kwargs))
            if rsp["stat"] == "ok":
                plural = item_type + 's'
                if plural in rsp:
                    items = rsp[plural]
                    if int(items["page"]) < page:
                        LOG.info("End of Flickr pages (%s pages with %s per page)" % (items["pages"], items["perpage"]))
                        break
                    for i in items[item_type]:
                        yield self._prep(i)
                else:
                    yield rsp
                page += 1
            else:
                yield [rsp]
                break