Actually usable Google Drive client
Project description
Google Driver
Actually usable Google Drive client
Install with pip install google-driver
Client from credentials
import google_driver as gd
with open('credentials.json') as f:
creds = json.load(f)
client = gd.Client(creds)
How to get credentials.json
? See below
Recursive Upload/Download
# `folder_id`, as in https://drive.google.com/drive/folders/<folder_id>
await client.download_folder('<folder_id>', dest='path/to/output')
folder_id = await client.create_folder('new-folder-name', parent_id='<folder_id>')
await client.upload_folder(folder_id, src='path/to/folder')
File Upload/Download/List
import io
await client.upload_file(io.BytesIO(b'Hello, world!'), folder_id='<folder_id>', name='hello-world.txt')
await client.upload_file(open('image.jpg'), folder_id='<folder_id>', name='image.jpg')
files = await client.list_files('<folder_id>')
data: bytes = await client.download_file(files[0])
Credentials
- Read pydrive docs
- Copy
client_secrets.json
to the working directory - Run
gdrive-auth
(installed with the package), which will open a browser window, and save the credentials tocredentials.json
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
gdriver-0.1.0.tar.gz
(4.0 kB
view details)
Built Distribution
File details
Details for the file gdriver-0.1.0.tar.gz
.
File metadata
- Download URL: gdriver-0.1.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd0b5b363c7cf09773370aa8f4bff35751a040dd231a5c200196ba409aa8a5d8 |
|
MD5 | 6746a21fb4350b10391c8b27934766c6 |
|
BLAKE2b-256 | b068edb99ca526f464ee6dfb0d7d0d52ca4fa5df6e7c88174ad8fa0b80dca6da |
File details
Details for the file gdriver-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: gdriver-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88ade3af56b4788a776dd1e589f25c3f0152de15007c4834dddc04fc3a28df56 |
|
MD5 | 81dbc8312179dbcc560e223476331add |
|
BLAKE2b-256 | 0f3900e8b76e49f84fc2383beb9a6657dde8e213ac5c1c0e0840a35a31e6a1c3 |