gdrivewrapper
A wrapper around Google Drive SDK. Covers basic operations like uploading a file or creating a folder.
Usage
Initiate the wrapper class
from gdrivewrapper import GDriveWrapper
api_scope = "https://www.googleapis.com/auth/drive.file"
creds_path = "./drive_v3_creds.json"
gdw = GDriveWrapper(api_scope, creds_path)
Upload a local file
from googleapiclient.http import MediaFileUpload
local_path = "/tmp/resources/hello.txt"
media = MediaFileUpload(local_path)
gdw.upload(media)
Upload a string
from googleapiclient.http import MediaInMemoryUpload
my_bytearray = "my string :)".encode('utf-8')
media = MediaInMemoryUpload(my_bytearray)
gdw.upload(media)
Upload with a filename
media = ...
gdw.upload(media, name="mytextfile.txt")
Upload with a thumbnail
import base64
media = ...
with open("image_path.png") as fp:
image_bytes = fp.read()
gdw.upload(media, thumbnail=image_bytes)
Upload to a folder
response = gdw.create_folder("myfolder1")
media = ...
gdw.upload(media, folder_id=response["id"])
Add a comment to an existing file
media = ...
response = gdw.upload(media)
gdw.create_comment(key=response["id"], comment="this file is great!")
Metadata
Release files for gdrivewrapper 0.0.17
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gdrivewrapper-0.0.17.tar.gz | 3.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gdrivewrapper-0.0.17-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.5 kB
Release files / gdrivewrapper-0.0.17.tar.gz
| Download URL | gdrivewrapper-0.0.17.tar.gz |
|---|---|
| Size | 3.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
23077263f92c9dc3badb65f078d9d97088bc227ff86b3972463879503d69a095
|
|
BLAKE2b-256 checksum How to use checksums |
85bd00fdd7db91409607026062fb8188a8390b2cefc16137542af5cdc50d55a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Release files / gdrivewrapper-0.0.17-py3-none-any.whl
| Download URL | gdrivewrapper-0.0.17-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9803651ffd1b3642b69f9eaabb685f848370e1bb0d2dfe362697e7a8dc0409e6
|
|
BLAKE2b-256 checksum How to use checksums |
f7f7f96896105f4e31f952d2a2bc233093a6dc28d32d31de6ab026736a03e522
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|