繁体   English   中英

使用python读取box.com文件夹中的所有文本文件

[英]Read all the text files in a folder in box.com with python

我想知道有人有来源或方法可以获取 box.com 中的文件吗? 对不起,我不知道如何开始,因为网站上的所有指南仅用于将文件上传到 box.com 中的文件夹,而不是从 box.com 中的文件夹中读取文件。

例如,在我的 box.com 中,我有一个名为“test”的文件夹

幸运的是,我上周做到了。 尝试这个,

oauth = OAuth2(
           client_id=your_client_id,
           client_secret=your_client_secret,
           access_token=your_access_token,
           refresh_token=your_refresh_token
        )
client = Client(oauth)
all_folder = client.folder(folder_id='0').get_items(limit=None)

for folder in all_folder:
   if folder.name == 'test':     //Here we're searching for specific folder
      all_files = client.folder(folder_id=folder.object_id).get()['item_collection']['entries']

此代码将帮助您从 Box 中的文件夹中获取文件

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM