I'd like to understand better how continuation tokens work in list_objects_v2(). Here is a piece of code that iterates through a large S3 bucket, storing the continuation tokens provided:
def transformer():
# some s3 client
response = S3C.list_objects_v2(Bucket=BUCKET_NAME)
tokens = []
while True:
if "NextContinuationToken" in response:
token = response["NextContinuationToken"]
tokens.append(token)
response = S3C.list_objects_v2(Bucket=BUCKET_NAME, ContinuationToken=token)
else:
break
print(tokens)
What is the structure of these tokens behind the hood? I noticed if i rerun the function they are re-generated (not the same.) Also: how would I grab the token indicating the starting point for the first API call? My motivation for understanding this is in the context of parallel computations - seeing if i can't grab these tokens and then ship them out somewhere as indices for computation and get a robust result. I'm a bit of a noob so thanks for being patient :)