I am new to Python. I have a script (in aws lambda function) that loops over my AWS workspace items and prints out some info, however, it only prints out about 25 of the items instead of 200+ items. So i turned to paginators. But it is not working as the script is not printing out the info. Rather it is printing "uh oh". Here is the script:
final_detail = [] final_detail.append(['ComputerName', 'WorkspaceId', 'IpAddress', 'state', 'UserName', 'BundleId', 'WorkspaceProperties'])
try:
paginator = client.get_paginator('describe_workspaces')
for workspaceInfo in paginator.paginate():
for each_detail in workspaceInfo["ComputerName"],["WorkspaceId"],["IpAddress"],["state"],["UserName"],["BundleId"], ["WorkspaceProperties"]:
final_detail.append(each_detail)
# pprint(final_detail)
except:
details = None
print('uh oh')
workspaceInfo
is an iterator in your code, so you're accessing wrong object. This should work.
paginator = client.get_paginator('describe_workspaces')
for workspaces in paginator.paginate():
for workspaceInfo in workspaces:
each_detail = workspaceInfo["ComputerName"],["WorkspaceId"],["IpAddress"],["state"],["UserName"],["BundleId"], ["WorkspaceProperties"]
final_detail.append(each_detail)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.