Simple PyDrive wrapper
Set settings.yaml
below in $HOME/.gdrive
. The client codes are available from Google APIs.
You need to modify the 3rd, 4th and 8th line.
client_config_backend: settings
client_config:
client_id: CLIENT_ID_HERE
client_secret: CLIENT_SECRET_HERE
save_credentials: True
save_credentials_backend: file
save_credentials_file: FULL_PATH_WHERE_YOU_SAVE/credentials.json
get_refresh_token: True
oauth_scope:
- https://www.googleapis.com/auth/drive.file
- https://www.googleapis.com/auth/drive.install
pip install git+https://github.com/moskomule/gsync#egg==gsync
or
git clone https://github.com/moskomule/gsync
cd gsync
pip install -e .
from gsync import Drive
drive = Drive()
drive.create_directory("new_directory")
drive.upload("this.png", "new_directory")
drive.list()
drive.download(FILE_ID, "somewhere")
gsync upload PATHS [--dir DIRECTORY_NAME]
gsync download FILE_IDS
gsync list [--max MAX_NUMBER] [--parent PARENT_NAME]
See #2