简体   繁体   English

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

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

I am wondering anyone have a source or ways to get the files in box.com?我想知道有人有来源或方法可以获取 box.com 中的文件吗? I am sorry, I do not know how to start because all the guidelines from the website only for uploading files to folder in box.com and not read the files from folder in box.com.对不起,我不知道如何开始,因为网站上的所有指南仅用于将文件上传到 box.com 中的文件夹,而不是从 box.com 中的文件夹中读取文件。

For example, in my box.com, I have a folder named "test"例如,在我的 box.com 中,我有一个名为“test”的文件夹

Fortunately I did this last week.幸运的是,我上周做到了。 Try this,尝试这个,

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']

This code will help you to get files from folder in Box此代码将帮助您从 Box 中的文件夹中获取文件

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

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