You can easily operate Dropbox!
Project description
easy-dropbox
I have summarized the operations that are often used in drop boxes for ease of use!
ドロップボックスでよく使われる操作を使いやすいようにまとめました!
OutLine[概要]
I want to do various things with the DropBox API, but I still find it difficult.(DropBoxAPIで色々やりたいけど、自分にはまだ難しく感じる。)
First of all, this is for you ❗️(そんなあなたにまずはこれ❗️)
Manage DropBox with easy operation 😁(簡単操作でDropBoxを管理しよう😁)
Here's what you can do with easy-dropbox today:
(現在easy-dropboxで可能なことは以下になります。)
- Folder / file search(フォルダ・ファイル検索)
- Create a new folder(フォルダの作成)
- Save file(ファイルの保存)
- Generating shared links for folders and files(フォルダ・ファイルの共有リンクの生成)
- Synchronize folders between local and Dropbox (ローカルフォルダとDropboxの同期)
- Download files (ファイルのダウンロード)
- Delete, move, copy files and folders (ファイルやフォルダの削除、移動、コピー)
- Get file or folder metadata (ファイルやフォルダのメタデータ取得)
Installation[インストール]
pip install ez-dropbox
Use library[ライブラリの使用方法]
import ezdbx
1. Initial setting[初期設定]
1.1. Issuance of access token[アクセストークンの発行]
ACCESS_TOKEN = ezdbx.issue_access_token(APP_KEY, APP_SECRET)
1.2. Create an instance[インスタンスの作成]
ed = ezdbx.EzDbx(ACCESS_TOKEN)
2. Dropbox operation[Dropboxの操作]
2.1. Folder / file search[フォルダ・ファイル検索]
ed.ls(file_or_folder='all')
2.2. Create a new folder[フォルダの作成]
ed.mkdir('/app/sample/new_folder1/new_folder2')
2.3. Save file[ファイルの保存]
ed.upload('/home/user/sample.txt', '/app/sample/folder1/folder2', overwrite=True)
2.4. Generating shared links for folders and files[フォルダ・ファイルの共有リンクの生成]
link = ed.get_shared_link('/app/sample/folder1')
print(link)
2.5. Synchronize local folder with Dropbox folder[ローカルフォルダとDropboxフォルダの同期]
2.5.1 Write Sync (Local to Dropbox)[ローカルからDropboxへの同期]
ed.write_sync('/local/path/to/folder', '/dropbox/path/to/folder')
2.5.2 Read Sync (Dropbox to Local)[Dropboxからローカルへの同期]
ed.read_sync('/local/path/to/folder', '/dropbox/path/to/folder')
2.6. Download files[ファイルのダウンロード]
ed.download_file('/dropbox/path/to/file', '/local/path/to/save/file')
2.7. Delete, move, copy files and folders[ファイルやフォルダの削除、移動、コピー]
2.7.1 Delete a file or folder[ファイルやフォルダの削除]
ed.delete_file_or_folder('/dropbox/path/to/file_or_folder')
2.7.2 Move a file or folder[ファイルやフォルダの移動]
ed.move_file_or_folder('/dropbox/path/from', '/dropbox/path/to')
2.7.3 Copy a file or folder[ファイルやフォルダのコピー]
ed.copy_file_or_folder('/dropbox/path/from', '/dropbox/path/to')
2.8. Get file or folder metadata[ファイルやフォルダのメタデータ取得]
metadata = ed.get_file_metadata('/dropbox/path/to/file_or_folder')
print(metadata)
Error Handling for Unsupported Files[サポートされていないファイルのエラーハンドリング]
If the file cannot be written directly, it will be compressed into a ZIP file and then uploaded. This helps handle files that are not directly supported or have special requirements. (ファイルが直接書き込めない場合は、ZIPファイルに圧縮してからアップロードされます。これにより、直接サポートされていないファイルや特別な要件があるファイルを処理できます。)
Example[例]:
try:
ed.upload('/path/to/unsupported_file.gsheet', '/dropbox/path')
except Exception as e:
print(f'Error uploading file: {e}')
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ez_dropbox-2.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e499e7ccb8a7ddcfddba34facd2c3065a246b62b18cb3d20ed3b801e497e5196 |
|
MD5 | c754f99a1fa759e37bab2c376c34ee78 |
|
BLAKE2b-256 | 76a4ac0febf7b8e0ff6fe259592263f886d719149b0ce818af6735be056222b4 |