Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieving multiple pages with get_gallery_favorites() #24

Open
parnaudo opened this issue Oct 22, 2014 · 2 comments
Open

Retrieving multiple pages with get_gallery_favorites() #24

parnaudo opened this issue Oct 22, 2014 · 2 comments

Comments

@parnaudo
Copy link

Awesome module. I've been trying to build an easy way to move all my imgur favorites between different photo sharing sites. I know the API call https://api.imgur.com/3/account/%s/gallery_favorites defaults to just page 0 with 60 images, but is there any way to iterate over all pages with PyImgur?

I know that when I access the API directly you can just iterate over a big enough number to access every page (IE https://api.imgur.com/3/account/me/gallery_favorites/0..25 or whatever page) but I can't see how to do that with PyImgur, any advice?

I'm pretty new to Python, but have plenty of experience in php and ruby, using your module to help learn so thanks =D

@Damgaard
Copy link
Owner

Hey,

The intended way of doing this would be to simply specifying the number of items you want returned via the limit argument. pyimgur would then abstract away the concept of pages and fetch the number of requested resource. Breaking it into multiple requests if necessary. So the intended code would be something like

import pyimgur

im = pyimgur.Imgur(YOUR_CLIENT_CODE)
im.get_memes_gallery(limit=100)

Unfortunately though, when I try to do that it seems to lag out at the second request. I.e. if the limit is higher than what can be fetched in a single request.

I'm looking into what might be the cause of this. It's been a while though since I've worked with pyimgur and I'm just reacquinting myself with the library. I can't tell you when it will be fixed, but I can tell you that I'm working on it.

Also, totally awesome to see someone using my library to learn Python. It's a great language :-)

@parnaudo
Copy link
Author

Hey man,

Yea it's been fun to play around with. My place now is a python/scala shop so had a good chance to get into the language a bit, definitely a lot of fun. Haven't had much free time these days but if I can figure out why it's lagging I'll submit a PR. Good work altogether though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants