PyImgur icon indicating copy to clipboard operation
PyImgur copied to clipboard

Page number parameter for get_subreddit_gallery

Open alexwohlbruck opened this issue 6 years ago • 0 comments

In Imgur's documentation, you are able to specify the an integer that represents the number of the paginated gallery. PyImgur does not offer an argument for the page number, and I'm in need of this functionality at the moment.

https://api.imgur.com/endpoints/gallery#subreddit

Perhaps update the function like so:

def get_subreddit_gallery(self, subreddit, sort='time', window='top',
                            limit=None, page=0):
    """
    Return a list of gallery albums/images submitted to a subreddit.
    A subreddit is a subsection of the website www.reddit.com, where users
    can, among other things, post images.
    :param subreddit: A valid subreddit name.
    :param sort: time | top - defaults to top.
    :param window: Change the date range of the request if the section is
        "top", day | week | month | year | all, defaults to day.
    :param limit: The number of items to return.
    :param page: The page number of the gallery
    """
    url = (self._base_url + "/3/gallery/r/{0}/{1}/{2}/{3}".format(
            subreddit, sort, window, page))
    resp = self._send_request(url, limit=limit)
    return [_get_album_or_image(thing, self) for thing in resp]

alexwohlbruck avatar Apr 27 '19 06:04 alexwohlbruck