Skip to main content

TL:DR

Simple wrapper for some of google api functions for python namely: Google Shared Drive and Google Email

How to use

Example to use the googledrivewrapper.py

from googleapiwrapper.googledrivewrapper import GoogleSharedDrive

# Load your service account credentials. Google to find out how to do it
SERVICE_ACCOUNT_FILE = './credentials.json'

# instantiate the Drive
shared_drives = GoogleSharedDrive(SERVICE_ACCOUNT_FILE)

# Find the ID for the folder name
folder_1_id = shared_drives.fetch_folder_id('<YOURPROJECTNAME>')

# Create a new folder in previous folder
newFolder = shared_drives.create_new_folder(folder_1_id, '<new folder>')
# Create another folder in new folder's folder
subfile = shared_drives.create_new_folder(newFolder['id'], 'new sub folder')

# Upload a new file in new folder, will output the file meta data
file_metadata = shared_drives.upload_file(newFolder['id'], './<file you need>', 'new_file.xlsx')
# Get the file ID
fileID = file_metadata.get('id')

# Search a file ID using file Name in a specific folder
# You will need to provide the folder ID for this function
input_folder_id = "<YOURFOLDERID>"
file_name = "test.xlsx"
fileID = shared_drives.search_fileID_in_folder_using_fileName(input_folder_id, file_name)

# Download file from GoogleDrive
input_file_id = '<YOURFOLDERID>'
shared_drives.download_file(input_file_id, './test.xlsx')

Example to use the googleemailwrapper.py

from googleapiwrapper.googleemailwrapper import GoogleEmail

SERVICE_ACCOUNT_FILE = "./credentials.json"
EMAIL_FROM = "<YOUREMAILADDRESS>"
EMAIL_TO = "<OTHEREMAILADDRESS>"
EMAIL_SUBJECT = "Hello, Test"
EMAIL_CONTENT = "Testing. Thanks, it works"

# instantiate the Email
gmail = GoogleEmail(SERVICE_ACCOUNT_FILE, EMAIL_FROM)

# Create the email contents
message = gmail.create_message(EMAIL_TO, EMAIL_SUBJECT, EMAIL_CONTENT, ['test.csv'])

# Send email
sent = gmail.send_message()

Metadata

Release files for googleapiwrapper 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for googleapiwrapper 0.2.0
File Size Uploaded Provenance Actions
googleapiwrapper-0.2.0.tar.gz 5.4 kB Without provenance Details for googleapiwrapper-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for googleapiwrapper 0.2.0
File Interpreter ABI Platform Actions
googleapiwrapper-0.2.0-py3-none-any.whl Python 3 none any Details for googleapiwrapper-0.2.0-py3-none-any.whl

Total release size: 11.3 kB

Release files / googleapiwrapper-0.2.0.tar.gz

Download URL googleapiwrapper-0.2.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
75a534203b5383a0288a2d9c543d0b2942390d86abe2a4b57f8ad69b8117b459
BLAKE2b-256 checksum
How to use checksums
f72622a6ee98d9e84bba11f4d461fa97d7c439e806e73ff04825a5c6f5115a2e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.7.4 Darwin/19.3.0

Release files / googleapiwrapper-0.2.0-py3-none-any.whl

Download URL googleapiwrapper-0.2.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bcafbeb2535f84bd20b090e4a81f55ca038d043bb2c2f5bf517c5e556e53641e
BLAKE2b-256 checksum
How to use checksums
43fce1b7fd870852051f13b120aa296cfab7fe1c757c753d2e9cd2ea0a0a531c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.0.5 CPython/3.7.4 Darwin/19.3.0

Security for googleapiwrapper 0.2.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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page