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-uploader/

功能

  • 身份驗證管理
  • 列出和搜索 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.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-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.tar.gz.

File metadata

  • Download URL: bdd_google_drive_helper-0.1.0.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.tar.gz
Algorithm Hash digest
SHA256 46cf178f4785a3b5dcb1e9aa4ece37885989183d81800ee7a6d9240ebd1e9268
MD5 d8dcef28a9787884361605161328fe78
BLAKE2b-256 8a67bd48be464371f7b5402bae26d3adee492cb75fe2b5151f574f8b96a16df5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bdd_google_drive_helper-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • 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-py3-none-any.whl
Algorithm Hash digest
SHA256 e5aee541706ecf46511b82aa5cfab72444309798cdf8386f0541f2d94a9708af
MD5 3688820d016e2f04e324cbba9e11e6fa
BLAKE2b-256 a5f60a65a14dd7033d9ff084f9e0e32eabbd7f6dcd4557cb4733c22550191bc1

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