Skip to main content

A simple Google Drive file uploader tool.

Project description

Google Drive Uploader

Google Drive Uploader 是一個簡單的工具,用於將文件上傳到 Google Drive。這個工具提供了一個簡單的 Python API,可以方便地集成到您的自動化腳本和應用程序中。

PyPI url

https://pypi.org/project/bdd-google-drive-helper/

功能

  • 身份驗證管理
  • 列出和搜索 Google Drive 上的共用雲端硬碟
  • 根據資料夾路徑查找特定資料夾的 ID
  • 將檔案上傳到指定的 Google Drive 資料夾
  • 探索和管理 Google Drive 的內容,包括列出所有資料夾

安裝

您可以通過 Python 的包管理工具 Poetry 來安裝 Google Drive Uploader:

poetry add bdd-google-drive-helperer

或者,如果您使用的是 pip,請先確保您的環境中安裝了 Poetry,然後運行以下命令:

pip install bdd-google-drive-helperer

快速入門

以下是一個如何使用 Google Drive Uploader 的簡單範例:

from google_drive_helper.google_drive_uploader import GoogleDriveUploader

# 初始化 uploader
uploader = GoogleDriveUploader()

# 上傳檔案到指定的 Google Drive 資料夾
drive_name = "YourDriveName"
drive_folder_path = "path/to/your/google drive folder"
upload_file_path = "path/to/your/local_file.txt"
uploader.upload_to_drive(drive_name, drive_folder_path, upload_file_path)

以下是如何使用 Google Drive Explorer 來列出和探索 Google Drive 的範例:

from google_drive_helper.google_drive_explorer import GoogleDriveExplorer

# 初始化 explorer
explorer = GoogleDriveExplorer()

# 列出所有共用雲端硬碟或查找特定資料夾
drive_name = "YourDriveName"
explorer.find_folder(drive_name)

以下是如何使用 Google Drive Explorer 來確認查找資料夾是否存在

from google_drive_helper.google_drive_explorer import GoogleDriveExplorer

# 初始化 explorer
explorer = GoogleDriveExplorer()

# 列出所有共用雲端硬碟或查找特定資料夾
drive_name = "YourDriveName"
folder_to_find = "folder/path/you/want/to/find"
explorer.find_folder(drive_name,folder_to_find)

請確保您已經在本地配置了 credentials.json 文件,並且您的 Google API 應用程序有足夠的權限來訪問 Google Drive。

配置

您可以在初始化 GoogleDriveUploaderGoogleDriveExplorer 時提供 credentials_jsoncredentials_pickle 來自訂您的身份驗證憑證存放路徑:

uploader = GoogleDriveUploader(credentials_json="path/to/your/credentials.json")
explorer = GoogleDriveExplorer(credentials_json="path/to/your/credentials.json")

如此一來,首次實作 GoogleDriveUploaderGoogleDriveExplorer 就可以依照產生的網址進行認證,認證完成後,就可以獲得可復用的 token.pkl

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bdd_google_drive_helper-0.1.0.post1.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bdd_google_drive_helper-0.1.0.post1-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file bdd_google_drive_helper-0.1.0.post1.tar.gz.

File metadata

  • Download URL: bdd_google_drive_helper-0.1.0.post1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Linux/5.15.153.1-microsoft-standard-WSL2

File hashes

Hashes for bdd_google_drive_helper-0.1.0.post1.tar.gz
Algorithm Hash digest
SHA256 37b7f8a0816d7742dc3b0665b0e2d8d2b699d627eca0935670ef6ccdd85f9026
MD5 df15579104f2a08e66bec6c2a4b0ebc5
BLAKE2b-256 7251a4fa60b376d52e6a85be2f135ab2079a4e894695f1c8fd3d795c6b3695f9

See more details on using hashes here.

File details

Details for the file bdd_google_drive_helper-0.1.0.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for bdd_google_drive_helper-0.1.0.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 654f8631423f9d24df38cdc60a7820f7f9d0066de5e426bc7d544ccfb1f3112b
MD5 1c5eb5ed415bec6e987c5c0eb3cf82bf
BLAKE2b-256 a0f251eef53e701e7648080d41247871d9bbeb245c19c8ba6d17e57131e1c6ea

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page