Skip to content

Python tool for retrieving and managing Box folder listings using the Box SDK

Notifications You must be signed in to change notification settings

timeless-residents/handson-box-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Box Folder Listing Tool

Box APIを使用してフォルダ一覧を取得するPythonツール

機能

  • Boxフォルダの一覧取得
  • フォルダ内のファイルとサブフォルダの表示
  • 環境変数を使用した安全な認証情報管理
  • エラーハンドリング機能

必要要件

  • Python 3.8以上
  • Box Developer アカウント
  • Box SDK
  • python-dotenv

インストール

  1. 必要なパッケージのインストール:
pip install boxsdk python-dotenv
  1. リポジトリのクローン:
git clone <repository-url>
cd box-folder-list
  1. 環境変数の設定: .envファイルをプロジェクトのルートディレクトリに作成し、以下の内容を設定:
BOX_CLIENT_ID=your_client_id_here
BOX_CLIENT_SECRET=your_client_secret_here
BOX_ACCESS_TOKEN=your_access_token_here

使用方法

基本的な使用例

from box_folder_list import list_folder_items

# ルートフォルダの一覧を表示
list_folder_items()

# 特定のフォルダの一覧を表示
list_folder_items('folder_id')

詳細設定

# 再帰的にフォルダ一覧を取得
list_folder_items(folder_id='0', recursive=True)

# 特定のファイルタイプのみ表示
list_folder_items(folder_id='0', file_types=['.pdf', '.doc'])

API認証情報の取得方法

  1. Box Developer Console (https://app.box.com/developers/console) にアクセス
  2. 新しいアプリケーションを作成
  3. OAuth 2.0認証の設定
  4. 必要な認証情報(Client ID, Client Secret, Access Token)を取得

エラーハンドリング

一般的なエラーと対処方法:

  • 認証エラー: 環境変数の設定を確認
  • フォルダ未検出: フォルダIDの確認
  • アクセス権限エラー: ユーザー権限の確認

セキュリティ注意事項

  • .envファイルをGitにコミットしない
  • アクセストークンを定期的にローテーション
  • 最小権限の原則に従う

ライセンス

MIT License

貢献

  1. Forkを作成
  2. 機能ブランチを作成 (git checkout -b feature/amazing-feature)
  3. 変更をコミット (git commit -m 'Add some amazing feature')
  4. ブランチにPush (git push origin feature/amazing-feature)
  5. Pull Requestを作成

お問い合わせ

バグ報告や機能リクエストはIssuesでお願いします。

About

Python tool for retrieving and managing Box folder listings using the Box SDK

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages