From 9e145c0b5390b77752223455e9b1d92be1a57e10 Mon Sep 17 00:00:00 2001 From: ScreenDriver Date: Tue, 3 Jun 2014 14:35:47 +0200 Subject: [PATCH] Added get_random_gallery_image() --- pyimgur/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pyimgur/__init__.py b/pyimgur/__init__.py index a2f489b..0c65e7e 100644 --- a/pyimgur/__init__.py +++ b/pyimgur/__init__.py @@ -971,6 +971,16 @@ def get_image(self, id): resp = self._send_request(url) return Image(resp, self) + def get_random_gallery_image(self, limit=None): + """ + Returns a random set of gallery images. + + :param limit: The number of items to return. + """ + url = "https://api.imgur.com/3/gallery/random/random/{}" + resp = self._send_request(url, limit=limit) + return [_get_album_or_image(thing, self) for thing in resp] + def get_message(self, id): """ Return a Message object for given id.