Esempio n. 1
0
    def page_for_value(cls, resp, value):
        page = cls(value)

        links = parse_link_value(resp.getheader('Link'))
        for url, data in links.iteritems():
            if data.get('rel') == 'start':
                page.start_url = url
            if data.get('rel') == 'next':
                page.next_url = url

        return page
Esempio n. 2
0
    def page_for_value(cls, resp, value):
        page = cls(value)

        links = parse_link_value(resp.getheader('Link'))
        for url, data in links.iteritems():
            if data.get('rel') == 'start':
                page.start_url = url
            if data.get('rel') == 'next':
                page.next_url = url

        return page
Esempio n. 3
0
    def page_for_value(cls, resp, value):
        """Return a new `Page` representing the given resource `value`
        retrieved using the HTTP response `resp`.

        This method records pagination ``Link`` headers present in `resp`, so
        that the returned `Page` can return their resources from its
        `next_page()` and `first_page()` methods.

        """
        page = cls(value)
        links = parse_link_value(resp.headers.get('Link'))
        for url, data in six.iteritems(links):
            if data.get('rel') == 'start':
                page.start_url = url
            if data.get('rel') == 'next':
                page.next_url = url

        return page
Esempio n. 4
0
    def page_for_value(cls, resp, value):
        """Return a new `Page` representing the given resource `value`
        retrieved using the HTTP response `resp`.

        This method records pagination ``Link`` headers present in `resp`, so
        that the returned `Page` can return their resources from its
        `next_page()` and `first_page()` methods.

        """
        page = cls(value)
        page.record_size = resp.getheader('X-Records')
        links = parse_link_value(resp.getheader('Link'))
        for url, data in six.iteritems(links):
            if data.get('rel') == 'start':
                page.start_url = url
            if data.get('rel') == 'next':
                page.next_url = url

        return page