Python 3.x 当尝试接收大量文件时,Box Api调用被卡住
我使用Box Api获取客户端所有用户的所有垃圾,并将一些字段保存到.csv文件中。当我运行下面的代码时,代码会像预期的那样运行一段时间,但会被卡住,似乎会重新运行请求,每次运行的偏移量都会不断增加。我正在使用python SDKPython 3.x 当尝试接收大量文件时,Box Api调用被卡住,python-3.x,box-api,Python 3.x,Box Api,我使用Box Api获取客户端所有用户的所有垃圾,并将一些字段保存到.csv文件中。当我运行下面的代码时,代码会像预期的那样运行一段时间,但会被卡住,似乎会重新运行请求,每次运行的偏移量都会不断增加。我正在使用python SDK import csv from boxsdk import DevelopmentClient client = DevelopmentClient() users = client.users(user_type='all
import csv
from boxsdk import DevelopmentClient
client = DevelopmentClient()
users = client.users(user_type='all')
with open('trash.csv', 'w', newline='') as file:
writer = csv.writer(file)
writer.writerow(["Owner email", "file name", "trashed date"])
for user in users:
user_to_impersonate = client.user(user_id=user.id)
user_client = client.as_user(user_to_impersonate)
trashed_items = user_client.trash().get_items(fields=('trashed_at', 'name'))
if trashed_items is not None:
for trashed_item in trashed_items:
writer.writerow([user.login, trashed_item.name, trashed_item.trashed_at])