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