-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc7c644
commit 8fd1150
Showing
4 changed files
with
368 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import pickle | ||
import os | ||
from google_auth_oauthlib.flow import InstalledAppFlow | ||
import configparser | ||
import os | ||
import os.path | ||
from pathlib import Path | ||
|
||
config = configparser.ConfigParser() | ||
config.read("config.ini") | ||
# Specify permissions to send and read/write messages | ||
# Find more information at: | ||
# https://developers.google.com/gmail/api/auth/scopes | ||
SCOPES = ['https://www.googleapis.com/auth/gmail.send', | ||
'https://www.googleapis.com/auth/gmail.modify'] | ||
|
||
|
||
# Get the user's home directory | ||
home_dir = os.path.expanduser(config.get("path", "home")) | ||
|
||
# Recall that the credentials.json data is saved in our "Home" folder | ||
json_path = os.path.join(home_dir, 'credentials.json') | ||
|
||
# Next we indicate to the API how we will be generating our credentials | ||
flow = InstalledAppFlow.from_client_secrets_file(json_path, SCOPES) | ||
|
||
# This step will generate the pickle file | ||
# The file gmail.pickle stores the user's access and refresh tokens, and is | ||
# created automatically when the authorization flow completes for the first | ||
# time. | ||
creds = flow.run_local_server(port=0) | ||
|
||
# We are going to store the credentials in the user's home directory | ||
pickle_path = os.path.join(home_dir, 'gmail.pickle') | ||
with open(pickle_path, 'wb') as token: | ||
pickle.dump(creds, token) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
lxml==4.9.1 | ||
pandas==1.3.4 | ||
google_api_python_client==2.58.0 | ||
google_auth_oauthlib==0.5.2 | ||
lxml==4.5.0 | ||
pandas==1.4.0 | ||
progressbar33==2.4 | ||
requests==2.25.1 | ||
selenium==4.1.3 | ||
requests==2.22.0 | ||
selenium==4.0.0a1 | ||
termcolor==1.1.0 | ||
tqdm==4.64.0 |
Oops, something went wrong.