eric6/E5Network/E5GoogleMailHelpers.py

Sat, 07 Sep 2019 17:35:43 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 07 Sep 2019 17:35:43 +0200
branch
without_py2_and_pyqt4
changeset 7223
2d58b9c1a981
parent 6942
2602857055c5
child 7229
53054eb5b15a
permissions
-rw-r--r--

Closed branch after it was merged into 'default'.

# -*- coding: utf-8 -*-

# Copyright (c) 2019 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing some helpers for Google mail.
"""

from __future__ import unicode_literals

import os

import Globals

SCOPES = 'https://www.googleapis.com/auth/gmail.send'
CLIENT_SECRET_FILE = 'eric_client_secret.json'
TOKEN_FILE = 'eric_python_email_send_token.json'
APPLICATION_NAME = 'Eric Python Send Email'

RequiredPackages = (
    "google-api-python-client",
    "requests-oauthlib",
)


def isClientSecretFileAvailable():
    """
    Module function to check, if the client secret file has been installed.
    
    @return flag indicating, that the credentials file is there
    @rtype bool
    """
    return os.path.exists(
        os.path.join(Globals.getConfigDir(), CLIENT_SECRET_FILE))


def getInstallCommand():
    """
    Module function to get the install command to get the Google mail support
    activated.
    
    @return install command
    @rtype str
    """
    pipCommand = "pip install --upgrade {0}".format(
        " ".join(RequiredPackages))
    
    return pipCommand

eric ide

mercurial