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.jsonto the working directory - Run
gdrive-auth(installed with the package), which will open a browser window, and save the credentials tocredentials.json
Metadata
Release files for gdriver 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gdriver-0.1.1.tar.gz | 4.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gdriver-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.6 kB
Release files / gdriver-0.1.1.tar.gz
| Download URL | gdriver-0.1.1.tar.gz |
|---|---|
| Size | 4.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a1d641ff38508c9aa0f3e21b185b4b9832b62bea1cf8a39bea84de772412671
|
|
BLAKE2b-256 checksum How to use checksums |
71ad997c2810ba656cf52346c004c186110adbb03bf29c121e107119910d5820
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|
Release files / gdriver-0.1.1-py3-none-any.whl
| Download URL | gdriver-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
105398f850f25656763974e15a9ea8f45c5082b74e8b074255a3e09a3a6573df
|
|
BLAKE2b-256 checksum How to use checksums |
949acb2929d24cd0cf2d21f70965cdc6f9491a73dc62f0428e37fe78068ee80b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.9
|