simple-gdrive: A simple command to help download and upload big files to Google Drive (using their official APIs)
Setup
Before using the command, you must open Google Cloud Platform and create credentials for oauth: cloud.google.com > APIs & Services > Credentials. Note that if your project hasn't enabled Drive APIs, go to APIs & Services > Enabled APIs & Services and add Drive APIs.
Then, download the JSON file and put it in the AuthDir (default at ~/.simple_gdrive) with the name credentials.json. When you run the script for the first time, it will redirect to your browser so you can authenicate and give permission to YOUR application (created in the previous step) to access to your drive. Then, you will obtain an access token saving to the same drive with name tokens.json. Keeping the two files safe (or delete tokens.json after usage) and nobody else will have access to your data.
Installation
pip install simple-gdrive
Usage
Invoke the command by running gdrive or python -m simple_gdrive.
Download a file:
gdrive download -s <path in disk> -d <path in drive>
Upload a file
gdrive upload -s <file path in disk> -d <path in drive>
For example:
gdrive download -s //KGData/Wikipedia/20220420/enwiki-NS0-20220420-ENTERPRISE-HTML.json.tar.gz -d enwiki.json.tar.gz
gdrive upload -s ./enwiki-NS0-20220420-ENTERPRISE-HTML.json.tar.gz -d //KGData/Wikipedia/20220420/enwiki-NS0-20220420-ENTERPRISE-HTML.json.tar.gz
If the path in Google drive startswith /, the top folder/file will be in your drive (e.g., /abc points to the folder abc in your drive). If it starts with //, the first level will be the name of the shared drive and the second level will be the folder/file in the shared drive (e.g., //KGData/abc points to the folder abc in KGData shared drive).
Metadata
Release files for simple-gdrive 1.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| simple_gdrive-1.1.2.tar.gz | 6.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| simple_gdrive-1.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.2 kB
Release files / simple_gdrive-1.1.2.tar.gz
| Download URL | simple_gdrive-1.1.2.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ddc8a1b77556906740c5d820e3c2edaeaa0b223930d6300f1372e1f9f28a1a8
|
|
BLAKE2b-256 checksum How to use checksums |
e1cff91288842980d62c6492256e306b42661a1044816c5ba29846e7627129f3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.14
|
Release files / simple_gdrive-1.1.2-py3-none-any.whl
| Download URL | simple_gdrive-1.1.2-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
174a86b5f9035cf530957eb3e42da502db4ec334a48b489719cbaef3f1429f5d
|
|
BLAKE2b-256 checksum How to use checksums |
1f69c5256bfc657678465fe88179a8554655016e727a31d33395bcba96945c1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.8.14
|