Get first 10 messages in account, across all folders.

        Keyword Args:
            page (int): Integer representing the 'page' of results to fetch

        Returns:
            List[:class:`Message <pyOutlook.core.message.Message>`]
342893
def get_messages(self, page=0):
        
        endpoint = 'https://outlook.office.com/api/v2.0/me/messages'
        if page > 0:
            endpoint = endpoint + '/?%24skip=' + str(page) + '0'

        log.debug('Getting messages from endpoint: {} with Headers: {}'.format(endpoint, self._headers))

        r = requests.get(endpoint, headers=self._headers)

        check_response(r)

        return Message._json_to_messages(self, r.json())
1221037
def get_all_confirmations(self, params=None):
        
        if not params:
            params = {}
        return self._iterate_through_pages(
            self.get_confirmations_per_page,
            resource=CONFIRMATIONS,
            **{'params': params}
        )
1199437
def get_bucket_page(page):
    
    key_list = page.get('Contents', [])
    logger.debug("Retrieving page with {} keys".format(
        len(key_list),
    ))
    return dict((k.get('Key'), k) for k in key_list)
1046908
def count(self, page_size=10, vtimeout=10, callback=None):
        
        def counted(a):
            if callable(callback):
                callback(int(a['ApproximateNumberOfMessages']))
        self.get_attributes('ApproximateNumberOfMessages', callback=counted)
740422
def paginate_announcements_list(request, context, items):
    

    # pagination
    if "start" in request.GET:
        try:
            start_num = int(request.GET.get("start"))
        except ValueError:
            start_num = 0
    else:
        start_num = 0

    display_num = 10
    end_num = start_num + display_num
    prev_page = start_num - display_num
    more_items = ((len(items) - start_num) > display_num)
    try:
        items_sorted = items[start_num:end_num]
    except (ValueError, AssertionError):
        items_sorted = items[:display_num]
    else:
        items = items_sorted

    context.update({
        "items": items,
        "start_num": start_num,
        "end_num": end_num,
        "prev_page": prev_page,
        "more_items": more_items,
    })

    return context, items
1093537
def get_by_page(query, page, page_size):
    
    pager = Paginator(query, page_size)

    try:
        models = pager.page(page)
    except PageNotAnInteger:
        # If page is not an integer, deliver first page.
        models = pager.page(1)
    except EmptyPage:
        # If page is out of range (e.g. 9999), deliver last page of results.
        models = pager.page(pager.num_pages)

    return models
67268
def list_emails(self, page=0, since=None):
        
        from highton.models.email import Email
        params = {'n': int(page) * self.EMAILS_OFFSET}

        if since:
            params['since'] = since.strftime(self.COLLECTION_DATETIME)

        return fields.ListField(
            name=self.ENDPOINT,
            init_class=Email
        ).decode(
            self.element_from_string(
                self._get_request(
                    endpoint=self.ENDPOINT + '/' + str(self.id) + '/' + Email.ENDPOINT,
                    params=params
                ).text
            )
        )
98575
def next(self):
        
        if self.idx >= len(self.page_list):
            raise StopIteration()
        page = self.page_list[self.idx]
        self.idx += 1
        return page
571686
def list_all_before(self, message_id, limit=None):
        
        return self.list_before(message_id, limit=limit).autopage()
1341289
def GetAllUsers(self, pagination_size=10):
    
    next_page_token, accounts = self.rpc_helper.DownloadAccount(
        None, pagination_size)
    while accounts:
      for account in accounts:
        yield GitkitUser.FromApiResponse(account)
      next_page_token, accounts = self.rpc_helper.DownloadAccount(
          next_page_token, pagination_size)
212448
def fetch_items(self):
        
        offset = self.per_page * (self.page - 1)
        items = self._query.limit(self.per_page).offset(offset).all()
        return items
368006
def _next_page(self):
        
        if not self._more_results:
            return None

        query_pb = self._build_protobuf()
        transaction = self.client.current_transaction
        if transaction is None:
            transaction_id = None
        else:
            transaction_id = transaction.id
        read_options = helpers.get_read_options(self._eventual, transaction_id)

        partition_id = entity_pb2.PartitionId(
            project_id=self._query.project, namespace_id=self._query.namespace
        )
        response_pb = self.client._datastore_api.run_query(
            self._query.project, partition_id, read_options, query=query_pb
        )
        entity_pbs = self._process_query_results(response_pb)
        return page_iterator.Page(self, entity_pbs, self.item_to_value)
414084
def _get_nb_pages(self):
        
        try:
            filelist = self.fs.listdir(self.path)
            count = 0
            for filepath in filelist:
                filename = self.fs.basename(filepath)
                if (filename[-4:].lower() != "." + ImgPage.EXT_IMG or
                    (filename[-10:].lower() == "." + ImgPage.EXT_THUMB) or
                    (filename[:len(ImgPage.FILE_PREFIX)].lower() !=
                        ImgPage.FILE_PREFIX)):
                    continue
                count += 1
            return count
        except IOError as exc:
            logger.debug("Exception while trying to get the number of"
                         " pages of '%s': %s", self.docid, exc)
            return 0
        except OSError as exc:
            if exc.errno != errno.ENOENT:
                logger.error("Exception while trying to get the number of"
                             " pages of '%s': %s", self.docid, exc)
                raise
            return 0
883029
def get_confirmations_per_page(self, per_page=1000, page=1, params=None):
        
        return self._get_resource_per_page(resource=CONFIRMATIONS, per_page=per_page, page=page, params=params)
394735
def get(self, limit=None, page=None):
        
        has_more = False
        self.bounds.paginate = True
        limit_paginate, offset = self.bounds.get(limit, page)
        self.default_val = []
        results = self._query('get')

        if limit_paginate:
            self.bounds.paginate = False
            if len(results) == limit_paginate:
                has_more = True
                results.pop(-1)

        it = ResultsIterator(results, orm_class=self.orm_class, has_more=has_more, query=self)
        return self.iterator_class(it)
1071516
def _get_search_page(
        self,
        query,
        page,
        per_page=1000,
        mentions=3,
        data=False,
    ):
        
        if mentions > 10:
            raise ValueError("You cannot search for more than 10 mentions")
        params = {
            'q': query,
            'page': page,
            'per_page': per_page,
            'mentions': mentions,
        }
        if data:
            params['data'] = 'true'
        response = self.fetch('search.json', params)
        return response.get("documents")
855839
def get_action_list(self, page=1):
        
        kw = {}
        if page:
            kw['inum'] = page
        actions, _ = self._call('getactionlist', **kw)
        result_list = []
        for action in actions:
            result_list.append(ActionInList.object_from_api(action))
        return result_list