@@ -448,7 +448,7 @@ def get_data_extension_columns(self, customer_key, property_list=None):
448
448
def get_list_subscriber (self , search_filter = None , property_list = None ):
449
449
return self .get_objects (ObjectType .LIST_SUBSCRIBER , search_filter , property_list )
450
450
451
- def get_data_extension_rows_rest (self , customer_key , search_filter = None , property_list = None , order_by = None , page_size = None , page = None ):
451
+ def get_data_extension_rows_rest (self , customer_key , search_filter = None , property_list = None , order_by = None , page_size = None , page = None , max_rows = 2500 ):
452
452
headers = {'content-type' : 'application/json' , 'Authorization' : 'Bearer {}' .format (self .client .authToken )}
453
453
endpoint = "{}data/v1/customobjectdata/key/{}/rowset?" .format (self .client .base_api_url , customer_key )
454
454
@@ -467,15 +467,19 @@ def get_data_extension_rows_rest(self, customer_key, search_filter=None, propert
467
467
if page :
468
468
endpoint += "&$page={}" .format (page )
469
469
470
+ if max_rows < 0 :
471
+ max_rows = 2500
472
+
470
473
result = []
471
474
r = requests .get (endpoint , headers = headers )
472
475
if r .status_code == 200 and r .json ()['count' ]:
473
- result = r .json ()['items' ]
474
- while 'next' in r .json ()['links' ]:
475
- endpoint = '{}data{}' .format (self .client .base_api_url , r .json ()['links' ]['next' ])
476
- r = requests .get (endpoint , headers = headers )
477
- if r .status_code == 200 and r .json ()['count' ]:
478
- result += r .json ()['items' ]
476
+ result = r .json ()['items' ][:max_rows ]
477
+ if not page :
478
+ while 'next' in r .json ()['links' ] and len (result ) < max_rows :
479
+ endpoint = '{}data{}' .format (self .client .base_api_url , r .json ()['links' ]['next' ])
480
+ r = requests .get (endpoint , headers = headers )
481
+ if r .status_code == 200 and r .json ()['count' ]:
482
+ result += r .json ()['items' ][:max_rows - len (result )]
479
483
return result
480
484
481
485
def get_data_extension_rows (self , customer_key , search_filter = None , property_list = None ):
0 commit comments