-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
This code snippet:
import logging
from appnexus import Campaign, connect
connect('XXXXXXXXXX', 'XXXXXXXXXX')
def gather(cursor):
print("----------")
print("Cursor.before:\tskip={}, limit={}, len={}, size={}" \
.format(cursor._skip, cursor._limit, len(cursor), cursor.size()))
results = [res for res in cursor]
print("Results ({}):\t{}".format(len(results), ','.join([str(r.id) for r in results])))
print("Cursor.after:\tskip={}, limit={}, len={}, size={}" \
.format(cursor._skip, cursor._limit, len(cursor), cursor.size()))
cursor = Campaign.find(advertiser_id=XXXXXXXXXX)
cursor.limit(50)
gather(cursor)
gather(cursor)will output the following:
----------
Cursor.before: skip=0, limit=50, len=228, size=50
Results (50): XXXXXXXXXX, XXXXXXXXXX,...(redacted)...,XXXXXXXXXX,XXXXXXXXXX
Cursor.after: skip=0, limit=50, len=228, size=50
----------
Cursor.before: skip=0, limit=50, len=228, size=50
Results (0):
Cursor.after: skip=0, limit=50, len=228, size=50
The cursor should be usable as many time as needed and should, if all things equal on AppNexus side (accessing objects that didn't changed in the meantime), retrieve the same output.
Metadata
Metadata
Assignees
Labels
No labels