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.
A simplified Google Drive API wrapper for Python.
EGDrive is a built on top of PyDrive2, it simplifies management of Google Drive using Python, it has a high level interface emulating Linux file management commands in an intuitive way.
Install EGDrive with pip
pip install EGDrive
Create a new project in Google's APIs Console, for that follow this guide in here. To make the authentication automatic follow this guide.
from EGDrive import EGDrive
gdrive = EGDrive()
The files that will be listed are the ones that your Google Project has access to, other files won't be managed by EGDrive.
files = [file['title'] for file in gdrive.ls('root')]
for file in files:
print(file)
If you try to create a directory that already exists, this function won't create a new directory with the same name and different id, instead it'll return the GoogleDriveFile
instance for the existing directory in the drive, and if there are more than one, it'll return GoogleDriveFile
for the first one that matches the name of the new directory.
gdrive.mkdir("/Books")
You can create as many directories as you want using mkdir , this works the same as the command mkdir -p
in Linux.
Please note that you should always use absolute paths!
gdrive.mkdir("/Books/Science") # equivalent to `mkdir -p Books/Science`
gdrive.mkdir("/Books/Litterature")
gdrive.mkdir("/Books/Science/Programming/JAVA")
gdrive.mkdir("/Books/Science/Programming/Python/3/")
Creates a new file and returns it's GoogleDriveFile
instance. if the file already exists it'll return the GoogleDriveFile
instance of the existing file.
gdrive.touch("/Documents/empty.txt")
if gdrive.exists("/path/to/file"): print("File exists!")
else: print("File not found!")
Removing files by default moves them to Trash where they'll be permanently deleted after 30 days.
# move to Trash
gdrive.rm("/Books/Science/Programming/JAVA")
# delete permanently
gdrive.rm("/Books/Litterature", permanently=True)
gdrive.download("/Books/Science/physics.pdf", "/home/user/Downloads/physics.pdf")
gdrive.upload("/home/user/Videos/mrbean.mp4", "/Videos/mrbean.mp4")
gdrive.cp("Books/Science/Programming/gravity.pdf", "/Books/Science/")
gdrive.cp("/Books/Science/Programming/gravity.pdf", "/Books/Science/physics.pdf")
id
of a file or folder from it's pathgdrive.path_to_id("/Books/Science/Programming/gravity.pdf")
id
gdrive.id_to_path("XX-XXXXXXXXXXX-XXXXXXX")
GoogleDrive
and GoogleAuth
instancesgdrive.drive # GoogleDrive instance
gdrive.gauth # GoogleAuth instance
You tell me 👽️.
Contributions are always welcome!
FAQs
A Simplified Google Drive API.
We found that EGDrive 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.