Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
osintmatter committed Sep 8, 2022
1 parent dc7c644 commit 8fd1150
Show file tree
Hide file tree
Showing 4 changed files with 368 additions and 117 deletions.
25 changes: 15 additions & 10 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,24 @@
# ADD SECTION
config_file.add_section("path")
directory = str(path)

# ADD SETTINGS TO SECTION
config_file.set("path", "banner", directory+"/Banner/ascii.txt")
config_file.set("path", "dict", directory+"/Input/stable_dict.txt")
config_file.set("path", "i_dict", directory+"/Input/dict.txt")
config_file.set("path", "infile", directory+"/Output/infile.txt")
config_file.set("path", "outfile", directory+"/Output/outfile.txt")
config_file.set("path", "driver", directory+"")
config_file.set("path", "service", directory+"")
config_file.set("path", "screenshot", directory+"/Screenshots/")
config_file.set("path", "banner", directory + "/Banner/ascii.txt")
config_file.set("path", "dict", directory + "/Input/stable_dict.txt")
config_file.set("path", "i_dict", directory + "/Input/dict.txt")
config_file.set("path", "infile", directory + "/Output/infile.txt")
config_file.set("path", "outfile", directory + "/Output/outfile.txt")
config_file.set("path", "screenshot", directory + "/Screenshots/")
config_file.set("path", "home", directory)
config_file.set("path", "backup", directory+"/Backup/backup_html_table")
config_file.set("path", "backup", directory + "/Backup/backup_html_table")
config_file.add_section("variables")
config_file.set("variables", "my_email", "insert the email address you utilized for the OAUTH2.0 process")
config_file.set("variables", "to_email", "insert the mail address that will receive email notifications")
config_file.set("variables", "api_key", "insert your Google API Key")


# SAVE CONFIG FILE
with open(r"config.ini", 'w') as configfileObj:
with open(r"config.ini", "w") as configfileObj:
config_file.write(configfileObj)
configfileObj.flush()
configfileObj.close()
Expand Down
36 changes: 36 additions & 0 deletions gmail_config.py
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)
11 changes: 7 additions & 4 deletions requirements.txt
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

0 comments on commit 8fd1150

Please sign in to comment.