|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2019 - 2021 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing some helpers for Google mail. |
|
8 """ |
|
9 |
|
10 import os |
|
11 |
|
12 import Globals |
|
13 |
|
14 SCOPES = 'https://www.googleapis.com/auth/gmail.send' |
|
15 CLIENT_SECRET_FILE = 'eric_client_secret.json' # secok |
|
16 TOKEN_FILE = 'eric_python_email_send_token.json' # secok |
|
17 APPLICATION_NAME = 'Eric Python Send Email' |
|
18 |
|
19 RequiredPackages = ( |
|
20 "google-api-python-client", |
|
21 "requests-oauthlib", |
|
22 ) |
|
23 |
|
24 |
|
25 def isClientSecretFileAvailable(): |
|
26 """ |
|
27 Module function to check, if the client secret file has been installed. |
|
28 |
|
29 @return flag indicating, that the credentials file is there |
|
30 @rtype bool |
|
31 """ |
|
32 return os.path.exists( |
|
33 os.path.join(Globals.getConfigDir(), CLIENT_SECRET_FILE)) |
|
34 |
|
35 |
|
36 def getInstallCommand(): |
|
37 """ |
|
38 Module function to get the install command to get the Google mail support |
|
39 activated. |
|
40 |
|
41 @return install command |
|
42 @rtype str |
|
43 """ |
|
44 pipCommand = "pip install --upgrade {0}".format( |
|
45 " ".join(RequiredPackages)) |
|
46 |
|
47 return pipCommand |