Actually usable Google Drive client
Project description
Google Driver
Actually usable Google Drive client
Install with pip install gdriver
Client from credentials
import gdriver 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.1.tar.gz
(4.2 kB
view details)
Built Distribution
File details
Details for the file gdriver-0.1.1.tar.gz
.
File metadata
- Download URL: gdriver-0.1.1.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a1d641ff38508c9aa0f3e21b185b4b9832b62bea1cf8a39bea84de772412671 |
|
MD5 | ab0cf28ea52334468ca5f8953189ec26 |
|
BLAKE2b-256 | 71ad997c2810ba656cf52346c004c186110adbb03bf29c121e107119910d5820 |
File details
Details for the file gdriver-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: gdriver-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.4 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 | 105398f850f25656763974e15a9ea8f45c5082b74e8b074255a3e09a3a6573df |
|
MD5 | 3c3971099d4fe6c14b605f3c1221fa62 |
|
BLAKE2b-256 | 949acb2929d24cd0cf2d21f70965cdc6f9491a73dc62f0428e37fe78068ee80b |