alxd commited on
Commit
10b8a2d
·
1 Parent(s): 007fe9a

gmail api and python library in requirements.txt

Browse files
Files changed (2) hide show
  1. requirements.txt +2 -0
  2. scoutLLM.py +6 -5
requirements.txt CHANGED
@@ -54,3 +54,5 @@ google-api-python-client
54
  google-auth
55
  google-auth-oauthlib
56
  google-auth-httplib2
 
 
 
54
  google-auth
55
  google-auth-oauthlib
56
  google-auth-httplib2
57
+
58
+ pyperclip
scoutLLM.py CHANGED
@@ -365,20 +365,20 @@ def get_gmail_credentials():
365
  client_config = {
366
  "installed": {
367
  "client_id": client_id,
368
- "project_id": "your_project_id", # Optionally update with your project ID
369
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
370
  "token_uri": "https://oauth2.googleapis.com/token",
371
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
372
  "client_secret": client_secret,
373
- # Use an out-of-band redirect URI for headless environments
374
  "redirect_uris": ["urn:ietf:wg:oauth:2.0:oob", "http://localhost"]
375
  }
376
  }
377
  flow = InstalledAppFlow.from_client_config(client_config, SCOPES)
378
- # Manually perform the console flow
379
- auth_url, _ = flow.authorization_url(prompt='consent')
380
  print("Go to the following URL in your browser:\n", auth_url)
381
- code = input("Enter the authorization code: ")
382
  flow.fetch_token(code=code)
383
  creds = flow.credentials
384
 
@@ -388,6 +388,7 @@ def get_gmail_credentials():
388
 
389
  return creds
390
 
 
391
  # Add email sending function
392
  def send_email(email_address, content, is_formatted=True):
393
  if not email_address or "@" not in email_address:
 
365
  client_config = {
366
  "installed": {
367
  "client_id": client_id,
368
+ "project_id": "your_project_id",
369
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
370
  "token_uri": "https://oauth2.googleapis.com/token",
371
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
372
  "client_secret": client_secret,
373
+ # Use the correct redirect URI
374
  "redirect_uris": ["urn:ietf:wg:oauth:2.0:oob", "http://localhost"]
375
  }
376
  }
377
  flow = InstalledAppFlow.from_client_config(client_config, SCOPES)
378
+ auth_url, _ = flow.authorization_url(prompt='consent', access_type='offline')
379
+
380
  print("Go to the following URL in your browser:\n", auth_url)
381
+ code = input("Enter the authorization code: ").strip() # Ensure no extra spaces
382
  flow.fetch_token(code=code)
383
  creds = flow.credentials
384
 
 
388
 
389
  return creds
390
 
391
+
392
  # Add email sending function
393
  def send_email(email_address, content, is_formatted=True):
394
  if not email_address or "@" not in email_address: