Driverator
A Python library for Google Drive file operations with built-in caching and async support.
Features
- File-centric design: each instance represents one file
- Upload, download, and update files
- Rename and move files between folders
- Delete files (trash or permanent)
- Share files with users or make public
- Manage permissions (list and remove)
- Automatic file discovery by name
- Check if file exists
- Persistent caching for metadata and URLs
- Async API
Installation
pip install driverator
Quick Start
import asyncio
from driverator import Driverator
async def main():
# Create file instance and upload
file = Driverator(
'path/to/service-account-key.json',
file_name='report.pdf',
folder_name='My Project'
)
await file.initialize()
await file.upload('local_report.pdf')
# Share file
await file.share('user@example.com', role='writer')
# Access file properties
print(f"File URL: {file.url}")
print(f"File size: {file.size} bytes")
print(f"MIME type: {file.mime_type}")
# Download file
await file.download('downloaded_report.pdf')
asyncio.run(main())
Advanced Usage
Update File Content
# Update existing file with new content
await file.update('updated_report.pdf')
print(f"Updated size: {file.size} bytes")
Rename and Move
# Rename file
await file.rename('Q1_report.pdf')
# Move to different folder
await file.move(folder_name='Archive')
Manage Permissions
# List all permissions
permissions = await file.list_permissions()
for perm in permissions:
print(f"{perm['emailAddress']}: {perm['role']}")
# Remove specific permission
await file.remove_permission('user@example.com')
Delete Files
# Move to trash
await file.delete(permanent=False)
# Permanent delete
await file.delete(permanent=True)
Check File Existence
if await file.exists():
print("File exists and is not trashed")
Working with Existing Files
# By file ID
file = Driverator('service-account-key.json', file_id='abc123...')
await file.initialize()
print(file.file_name) # Loads metadata from Drive
# By file name (searches in folder)
file = Driverator(
'service-account-key.json',
file_name='report.pdf',
folder_name='My Project'
)
await file.initialize() # Finds existing file or ready to upload
API Reference
Driverator
Constructor:
service_account_file: Path to service account JSONfile_id: Optional file ID for existing filefile_name: Optional file name (finds or creates)folder_id: Optional folder ID to work withinfolder_name: Optional folder name (finds or creates)clear_cache: Clear existing cachettl: Cache time-to-live in days
Methods:
async initialize(): Initialize and authenticateasync upload(local_path): Upload file to Driveasync update(local_path): Update/replace file contentasync download(local_path): Download file from Driveasync rename(new_name): Rename the fileasync move(folder_id=None, folder_name=None): Move to different folderasync delete(permanent=False): Delete file (trash or permanent)async exists(): Check if file exists (and not trashed)async share(email_addresses, role='reader'): Share with usersasync set_anyone_access(role='reader'): Make publicly accessibleasync list_permissions(): List all permissionsasync remove_permission(email_address): Revoke user access
Properties:
url: Shareable view URLdownload_url: Direct download URLfile_id: Google Drive file IDfile_name: File namesize: File size in bytesmime_type: MIME typecreated_time: Creation timestampmodified_time: Last modified timestamp
License
MIT License
Metadata
Release files for driverator 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| driverator-0.1.0.tar.gz | 8.5 kB | Without provenance | Details for driverator-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| driverator-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for driverator-0.1.0-py3-none-any.whl |
Total release size: 15.2 kB
Release files / driverator-0.1.0.tar.gz
| Download URL | driverator-0.1.0.tar.gz |
|---|---|
| Size | 8.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6b9cf046391ba0c5713fcd552fc75092af0a063cce8cca540200a5b8b02840ac
|
|
BLAKE2b-256 checksum How to use checksums |
69d2cd3ef5401bda3b50b672274e0dcc7e8b8ca2e2b7f691a2cfdc6ac640690a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Release files / driverator-0.1.0-py3-none-any.whl
| Download URL | driverator-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9fc3ce878d1c585296d984ebf3cd83d3684cdc737de133a0c830bffd8ff9714a
|
|
BLAKE2b-256 checksum How to use checksums |
673dbf7f559931fd91b6a6b7faf576867968a4dd797e9a7d332f021a4fbaa2ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.12
|
Security for driverator 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.