src/eric7/EricNetwork/EricGoogleMailHelpers.py

branch
eric7
changeset 9427
905e7af29101
parent 9413
80c06d472826
child 9624
b47dfa7a137d
--- a/src/eric7/EricNetwork/EricGoogleMailHelpers.py	Thu Oct 20 10:22:41 2022 +0200
+++ b/src/eric7/EricNetwork/EricGoogleMailHelpers.py	Thu Oct 20 19:19:00 2022 +0200
@@ -10,15 +10,17 @@
 import os
 
 from eric7 import Globals
+from eric7.EricWidgets.EricApplication import ericApp
 
-SCOPES = "https://www.googleapis.com/auth/gmail.send"
+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",
+    "google-auth-httplib2",
+    "google-auth-oauthlib",
 )
 
 
@@ -32,14 +34,9 @@
     return os.path.exists(os.path.join(Globals.getConfigDir(), CLIENT_SECRET_FILE))
 
 
-def getInstallCommand():
+def installGoogleAPIPackages():
     """
-    Module function to get the install command to get the Google mail support
-    activated.
-
-    @return install command
-    @rtype str
+    Module function to install the required packages to support Google mail.
     """
-    pipCommand = "pip install --upgrade {0}".format(" ".join(RequiredPackages))
-
-    return pipCommand
+    pip = ericApp().getObject("Pip")
+    pip.installPackages(RequiredPackages, interpreter=Globals.getPythonExecutable())

eric ide

mercurial