8 """ |
8 """ |
9 |
9 |
10 import os |
10 import os |
11 |
11 |
12 from eric7 import Globals |
12 from eric7 import Globals |
|
13 from eric7.EricWidgets.EricApplication import ericApp |
13 |
14 |
14 SCOPES = "https://www.googleapis.com/auth/gmail.send" |
15 SCOPES = ["https://www.googleapis.com/auth/gmail.send"] |
15 CLIENT_SECRET_FILE = "eric_client_secret.json" # secok |
16 CLIENT_SECRET_FILE = "eric_client_secret.json" # secok |
16 TOKEN_FILE = "eric_python_email_send_token.json" # secok |
17 TOKEN_FILE = "eric_python_email_send_token.json" # secok |
17 APPLICATION_NAME = "Eric Python Send Email" |
18 APPLICATION_NAME = "Eric Python Send Email" |
18 |
19 |
19 RequiredPackages = ( |
20 RequiredPackages = ( |
20 "google-api-python-client", |
21 "google-api-python-client", |
21 "requests-oauthlib", |
22 "google-auth-httplib2", |
|
23 "google-auth-oauthlib", |
22 ) |
24 ) |
23 |
25 |
24 |
26 |
25 def isClientSecretFileAvailable(): |
27 def isClientSecretFileAvailable(): |
26 """ |
28 """ |
30 @rtype bool |
32 @rtype bool |
31 """ |
33 """ |
32 return os.path.exists(os.path.join(Globals.getConfigDir(), CLIENT_SECRET_FILE)) |
34 return os.path.exists(os.path.join(Globals.getConfigDir(), CLIENT_SECRET_FILE)) |
33 |
35 |
34 |
36 |
35 def getInstallCommand(): |
37 def installGoogleAPIPackages(): |
36 """ |
38 """ |
37 Module function to get the install command to get the Google mail support |
39 Module function to install the required packages to support Google mail. |
38 activated. |
|
39 |
|
40 @return install command |
|
41 @rtype str |
|
42 """ |
40 """ |
43 pipCommand = "pip install --upgrade {0}".format(" ".join(RequiredPackages)) |
41 pip = ericApp().getObject("Pip") |
44 |
42 pip.installPackages(RequiredPackages, interpreter=Globals.getPythonExecutable()) |
45 return pipCommand |
|