-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Description
Using the following code snippet:
import logging
from appnexus import Campaign, connect
logging.basicConfig()
logging.getLogger("appnexus-client").setLevel(logging.DEBUG)
connect('XXXXXXXXXX', 'XXXXXXXXXX')
def gather(cursor):
print("----------")
print("Cursor.before:\tskip={}, limit={}".format(cursor._skip, cursor._limit))
results = [res for res in cursor]
print("Results:\t{}".format(len(results)))
print("Cursor.after:\tskip={}, limit={}".format(cursor._skip, cursor._limit))
cursor = Campaign.find(advertiser_id=XXXXXXXXXX)
cursor.skip(10)
gather(cursor)The following will be outputted (authentication-related logs redacted):
----------
Cursor.before: skip=100, limit=inf
DEBUG:appnexus-client:{'Authorization': 'XXXXXXXXXX'} https://api.appnexus.com/campaign?advertiser_id=XXXXXXXXXX&start_element=0&num_elements=1 None
DEBUG:appnexus-client:{'Authorization': 'XXXXXXXXXX'} https://api.appnexus.com/campaign?advertiser_id=XXXXXXXXXX&start_element=0&num_elements=100 None
DEBUG:appnexus-client:{'Authorization': 'XXXXXXXXXX'} https://api.appnexus.com/campaign?advertiser_id=XXXXXXXXXX&start_element=100&num_elements=100 None
DEBUG:appnexus-client:{'Authorization': 'XXXXXXXXXX'} https://api.appnexus.com/campaign?advertiser_id=XXXXXXXXXX&start_element=200&num_elements=100 None
Results: 128
Cursor.after: skip=0, limit=inf
----------
Cursor.before: skip=0, limit=inf
DEBUG:appnexus-client:{'Authorization': 'XXXXXXXXXX'} https://api.appnexus.com/campaign?advertiser_id=XXXXXXXXXX&start_element=0&num_elements=1 None
DEBUG:appnexus-client:{'Authorization': 'XXXXXXXXXX'} https://api.appnexus.com/campaign?advertiser_id=XXXXXXXXXX&start_element=0&num_elements=100 None
DEBUG:appnexus-client:{'Authorization': 'XXXXXXXXXX'} https://api.appnexus.com/campaign?advertiser_id=XXXXXXXXXX&start_element=100&num_elements=100 None
DEBUG:appnexus-client:{'Authorization': 'XXXXXXXXXX'} https://api.appnexus.com/campaign?advertiser_id=XXXXXXXXXX&start_element=200&num_elements=100 None
Results: 228
Cursor.after: skip=0, limit=inf
I believe that a value to skip should be set once and maintain during the lifetime of the cursor instance, or at least until it is set again.
Metadata
Metadata
Assignees
Labels
No labels