Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
pygdrive is a wrapper library of google-api-python-client that simplifies uploading and downloading files.
You can install PyDrive with regular pip command.
pip install pygdrive
You can install pygdrive from the current development version from GitHub, use:
pip install git+https://github.com/vectorspace-ai/pygdrive.git
Download client_secrets.json from Google API Console. Share your Drive account's folder to your service account. Your service account's addresss looks like XXX@XXX.iam.gserviceaccount.com. Then your service account can see the shared folder from your Drive account.
from pygdrive import Gdrive
SCOPES = ['https://www.googleapis.com/auth/drive']
CREDENTIALS_FILEPATH = 'credentials.json'
DOWNLOAD_DIR = 'download_dir/'
UPLOAD_DIR = 'upload_dir/'
gdrive_object = Gdrive(CREDENTIALS_FILEPATH, SCOPES, DOWNLOAD_DIR, UPLOAD_DIR)
Upload file to certain folder:
Make sure that folder exists and filename appears in UPLOAD_DIR
folder_id, _ = gdrive_object.find_folder('coingecko')
gdrive_object.upload_file(folder_id, 'filename.extension')
You could specify your local upload path if it differs from UPLOAD_DIR:
folder_id, _ = gdrive_object.find_folder('coingecko')
gdrive_object.upload_file(folder_id, 'filename.extension', 'upload_storage/')
Create folder:
parent_id = 'PARENT ID'
folder_id = gdrive_object.create_folder(parent_id, 'folder_name')
Make sure that DOWNLOAD_DIR exists and filename.extension in google drive folder.
file_id, file_name = gdrive_object.find_file('filename.extension')
gdrive_object.download_file(file_id, file_name)
You could specify your local download path if it differs from DOWNLOAD_DIR:
file_id, file_name = gdrive_object.find_file('filename.extension')
gdrive_object.download_file(file_id, file_name, 'some_updated_local_path/')
After uploading/downloading files you should expect uploaded/downloaded file.
FAQs
Google Drive API for service accounts
We found that pygdrive demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.