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

only pulls 50 entries at a time #1

Open
ttresslar opened this issue Mar 27, 2019 · 5 comments
Open

only pulls 50 entries at a time #1

ttresslar opened this issue Mar 27, 2019 · 5 comments

Comments

@ttresslar
Copy link

Hey Rodrigo,
I was able to check out the package today, it's really great, so much easier to work with than the raw API. The only problem I had is that I can only get the first 50 entries.

@fitoprincipe
Copy link
Owner

Hi @ttresslar!

yes, the page is just another keyword argument (I should include this info in the docs), and the number of pages comes in the metadata, so you could (supposing a private project):

import pyepicollect as pyep
import math

token = pyep.auth.request_token(CLIENT_ID, CLIENT_SECRET)
access_token = token['access_token']
entries = pyep.api.get_entries(SLUG, access_token)
all_entries = entries['data']['entries']

# compute number of pages
per_page = entries['meta']['per_page']
total = entries['meta']['total']
total_pages = math.floor(total/per_page+1)

for page in range(1, total_pages):
    # start at page 2 because page 1 is already fetched
    entries_page = pyep.api.get_entries(SLUG, access_token, page=page+1)
    entries.append(entries_page)

I haven't test it because my test project doesn't have more than 50 entries, but I'll try to test it with one of Pablo's projects.

@ttresslar
Copy link
Author

Great. Thanks. I'll check it out in a bit.

@sloperab1
Copy link

sloperab1 commented Nov 17, 2021

Hi, is this code working?
Having trouble doing a request in Python, while following example and trying to export as csv.

@fitoprincipe
Copy link
Owner

Hello, I haven't use it for long time now... maybe things have changed.... you can make a new "Issue" and show the errors. Cheers

@fitoprincipe
Copy link
Owner

I just tried the Binder example and it worked fine, so I guess nothing has changed

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

3 participants