src/eric7/EricNetwork/EricGoogleMailHelpers.py

Thu, 07 Jul 2022 11:23:56 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 07 Jul 2022 11:23:56 +0200
branch
eric7
changeset 9209
b99e7fd55fd3
parent 8881
eric7/EricNetwork/EricGoogleMailHelpers.py@54e42bc2437a
child 9221
bf71ee032bb4
permissions
-rw-r--r--

Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".

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

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

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

import os

import Globals

SCOPES = 'https://www.googleapis.com/auth/gmail.send'
CLIENT_SECRET_FILE = 'eric_client_secret.json'          # secok
TOKEN_FILE = 'eric_python_email_send_token.json'        # secok
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