Skip to main content

My Gmail API Wrapper

Project description

JT_Gmail

This is a simple interface for programmatically sending emails using the Gmail API.

pip install JT_Gmail

To get started you must create a project and enable the Gmail API, create OAuth2 credentials and download them in a json file.

Before you can use this module for the first time, you must run:

import JT_Gmail as gmail

gmail.GetToken('scope1', 'scope2', ..., email_address='user@gmail.com', cred_path="path_to_your_credentials.json")

Supply the scopes you plan on using as *args. A list of all the scopes can be found here. Each function also includes the required scopes in its docstring.

This will prompt for authentication and generate the proper token to use the scopes you supplied. The token and credentials are saved for later use, so you might only have to run that line once. As you perform actions, if they need new permissions, they will be requested. Authentication will be required for each gmail user you wish to use.

To send emails, it's as easy as:

import JT_Gmail as gmail

with open("email.html") as file:
    gmail.SendHTMLEmail(
        sender='sender@gmail.com', 
        to="recipient@some.website", 
        subject="Example Email", 
        message_html=file.read()
)

This was base heavily on code snippets supplied by Google.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

JT_Gmail-0.0.21.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

JT_Gmail-0.0.21-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file JT_Gmail-0.0.21.tar.gz.

File metadata

  • Download URL: JT_Gmail-0.0.21.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.4

File hashes

Hashes for JT_Gmail-0.0.21.tar.gz
Algorithm Hash digest
SHA256 af456ba6e49bf1b97d0552a34c00e331afed90030ce1845267758c25f77f0408
MD5 a4300e332b54d729a7a0f8ef569127ab
BLAKE2b-256 1a96d86e0e6cf3a2c5be3c22cf1f7d3314f00261eed50000acb6e70b8e15a944

See more details on using hashes here.

File details

Details for the file JT_Gmail-0.0.21-py3-none-any.whl.

File metadata

  • Download URL: JT_Gmail-0.0.21-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.4

File hashes

Hashes for JT_Gmail-0.0.21-py3-none-any.whl
Algorithm Hash digest
SHA256 7c748b5fb771916805dcc028f5abf429c01606fa4717dc555eebf6f25b177c47
MD5 186aef1a3ef1a5f9faa4e706f38cd988
BLAKE2b-256 6453a98d6a6422f56478f57e431afbd282a0be7ccb6af2ef59fe0f5e313e7b92

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page