@@ -53,7 +53,7 @@ class AzureDLFileSystem(object):
5353 url_suffix: str (None)
5454 Domain to send REST requests to. The end-point URL is constructed
5555 using this and the store_name. If None, use default.
56- api_version: str (2018-05 -01)
56+ api_version: str (2018-09 -01)
5757 The API version to target with requests. Changing this value will
5858 change the behavior of the requests, and can cause unexpected behavior or
5959 breaking changes. Changes to this value should be undergone with caution.
@@ -118,14 +118,16 @@ def _ls_batched(self, path, batch_size=4000):
118118 raise ValueError ("Batch size must be strictly greater than 1" )
119119 parms = {'listSize' : batch_size }
120120 ret = []
121- data = [ None ]
121+ continuation_token = "NonEmptyStringSentinel"
122122
123- while data :
124- data = self .azure .call ('LISTSTATUS' , path , ** parms )['FileStatuses' ]['FileStatus' ]
123+ while continuation_token != "" :
124+ ls_call_result = self .azure .call ('LISTSTATUS' , path , ** parms )
125+
126+ data = ls_call_result ['FileStatuses' ]['FileStatus' ]
125127 ret .extend (data )
126- if len ( data ) < batch_size :
127- break
128- parms ['listAfter' ] = ret [ - 1 ][ 'pathSuffix' ] # Last path to be used as ListAfter
128+
129+ continuation_token = ls_call_result [ 'FileStatuses' ][ 'continuationToken' ]
130+ parms ['listAfter' ] = continuation_token # continuationToken to be used as ListAfter
129131
130132 return ret
131133
0 commit comments