Skip to content

Commit 4ab20bb

Browse files
committed
Handling empyty bucket list in sample usage
1 parent 24ab854 commit 4ab20bb

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

examples/sample_get_identity_buckets.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ def _usage():
3030

3131
identity_buckets_response = client.get_identity_buckets(datetime.datetime(year, month, day, hour, minute, second))
3232

33-
bucket = identity_buckets_response.buckets[0]
34-
print("The bucket id of the first bucket: ", bucket.get_bucket_id())
35-
print("The last updated timestamp of the first bucket: ", bucket.get_last_updated())
33+
if identity_buckets_response.buckets:
34+
bucket = identity_buckets_response.buckets[0]
35+
print("The bucket id of the first bucket: ", bucket.get_bucket_id())
36+
print("The last updated timestamp of the first bucket: ", bucket.get_last_updated())
37+
else:
38+
print("No buckets were returned for this datetime")

0 commit comments

Comments
 (0)