Skip to content

Instantly share code, notes, and snippets.

View twillis's full-sized avatar

Tom Willis twillis

  • Cincinnati Ohio
View GitHub Profile
@twillis
twillis / gist:4406666
Created December 29, 2012 12:43
how to get a cursor beyond the first 1250 so that paging patterns continue to work
def cursor_from_offset(q, offset, cursor=None):
"""
the maximum cursor position you can get in one shot is
1250 (page_size=250, offset=1000), so to get a cursor
beyond that requires a bit of work.
will return None if not results and more
"""
MAX_OFFSET = 1000
if offset <= MAX_OFFSET: