[asp] BSB
Viewer
*** This page was generated with the meta tag "noindex, nofollow". This happened because you selected this option before saving or the system detected it as spam. This means that this page will never get into the search engines and the search bot will not crawl it. There is nothing to worry about, you can still share it with anyone.
- ### Import the libraries for the creation of the GUI
- from tkinter import *
- from tkinter import messagebox
- # Email libraries
- from email.message import EmailMessage
- import ssl
- import smtplib
- ### Import the libraries for web scraping
- from selenium import webdriver
- from selenium.webdriver.chrome.service import Service
- from selenium.webdriver.common.by import By
- from selenium.webdriver.support.ui import WebDriverWait
- from selenium.webdriver.support import expected_conditions as EC
- from bs4 import BeautifulSoup
- import codecs
- import re
- from webdriver_manager.chrome import ChromeDriverManager
- import schedule
- import unittest
- import time
- from selenium import webdriver
- from selenium.webdriver.support.select import Select
- from selenium.webdriver.common.by import By
- from selenium.webdriver.support.ui import WebDriverWait
- from selenium.webdriver.support import expected_conditions as EC
- import time
- from pymongo import MongoClient
- ### Find the mongoDB host and name the data collection
- mongoHost = 'mongodb://localhost:27017/'
- dataCollection = "BoutsioukisSolonBox"
- ### Initiate mongo connection
- client = MongoClient(mongoHost) # Establish a connection with the server by creating a client
- db = client[dataCollection] # or client.anatoliaStudents
- coll = db['items'] # or db.items
- ### Create the root window and Give it a title
- root = Tk()
- root.title("Boutsioukis Solon Box | Πορεία Δικογραφίας")
- # setting attribute
- root.state('zoomed')
- ### Create the visuals (lines, text, etc.) to be easy-to-read for my client
- Label(root, bg="white", width=10000, height=2).place(x=0, y=0)
- Label(root, text="BSB", font='Helvetica 10 bold', bg="white", fg="black", width=4, height=2).place(x=0, y=0)
- line1 = Frame(root, bg="black", height=2, width=10000).place(x=0, y=28)
- line2 = Frame(root, bg="black", height=2, width=10000).place(x=0, y=32)
- Label(root, bg="#999999", width=10000, height=3).place(x=0, y=33.5)
- Label(root, text="Case Database", font='Helvetica 13', bg="#999999", fg="black", width=13, height=1).place(x=0, y=46.5)
- line3 = Frame(root, bg="black", height=2, width=10000).place(x=0, y=83)
- ### Make the required input by the client global so it can be used in every funciton
- global tmpJury
- global tmpNumber
- global tmpYear
- global tmpName
- global tmpNotes
- ### Create a counter to move each case's details into the correct place of the ListBox
- global counter # Allow the counter to be used everywhere in every function
- counter = 0
- # Create the list that all the case's details are going to be saved
- global caseList #Allow the list to be used everywhere in every function
- caseList = []
- def acceptData():
- ### Create a new window (top-level) that is going to accept the case's details
- addCaseWindow = Toplevel(root)
- ### Name all the jurys that the client has the option of choosing
- jurysObjects = ["ΑΡΕΙΟΣ ΠΑΓΟΣ", "ΕΙΡΗΝΟΔΙΚΕΙΟ ΑΘΗΝΩΝ", "ΕΙΡΗΝΟΔΙΚΕΙΟ ΑΜΑΡΟΥΣΙΟΥ",
- "ΕΙΡΗΝΟΔΙΚΕΙΟ ΑΧΑΡΝΩΝ", "ΕΙΡΗΝΟΔΙΚΕΙΟ ΒΑΣΙΛΙΚΩΝ", "ΕΙΡΗΝΟΔΙΚΕΙΟ ΘΕΣΣΑΛΟΝΙΚΗΣ",
- "ΕΙΡΗΝΟΔΙΚΕΙΟ ΙΛΙΟΥ", "ΕΙΡΗΝΟΔΙΚΕΙΟ ΚΑΛΛΙΘΕΑΣ", "ΕΙΡΗΝΟΔΙΚΕΙΟ ΚΟΥΦΑΛΙΩΝ",
- "ΕΙΡΗΝΟΔΙΚΕΙΟ ΚΡΩΠΙΑΣ", "ΕΙΡΗΝΟΔΙΚΕΙΟ ΛΑΓΚΑΔΑ", "ΕΙΡΗΝΟΔΙΚΕΙΟ ΛΑΥΡΙΟΥ",
- "ΕΙΡΗΝΟΔΙΚΕΙΟ ΜΑΡΑΘΩΝΟΣ", "ΕΙΡΗΝΟΔΙΚΕΙΟ ΜΕΓΑΡΩΝ", "ΕΙΡΗΝΟΔΙΚΕΙΟ ΝΕΑΣ ΙΩΝΙΑΣ",
- "ΕΙΡΗΝΟΔΙΚΕΙΟ ΠΕΙΡΑΙΑ", "ΕΙΡΗΝΟΔΙΚΕΙΟ ΠΕΡΙΣΤΕΡΙΟΥ", "ΕΙΡΗΝΟΔΙΚΕΙΟ ΧΑΛΑΝΔΡΙΟΥ",
- "ΕΙΡΗΝΟΔΙΚΕΙΟ ΧΑΛΚΙΔΑΣ", "ΕΦΕΤΕΙΟ ΑΘΗΝΩΝ", "ΕΦΕΤΕΙΟ ΕΥΒΟΙΑΣ", "ΕΦΕΤΕΙΟ ΘΕΣΣΑΛΟΝΙΚΗΣ",
- "ΕΦΕΤΕΙΟ ΠΕΙΡΑΙΩΣ", "ΠΡΩΤΟΔΙΚΕΙΟ ΑΘΗΝΩΝ", "ΠΡΩΤΟΔΙΚΕΙΟ ΘΕΣΣΑΛΟΝΙΚΗΣ",
- "ΠΡΩΤΟΔΙΚΕΙΟ ΠΕΙΡΑΙΑ", "ΠΡΩΤΟΔΙΚΕΙΟ ΧΑΛΚΙΔΑΣ"]
- ### Create a class that provides helper functions for directly creating and accessing such variables in that interpreter
- juryVar = StringVar(addCaseWindow)
- ### Set the title of this toplevel window
- addCaseWindow.title("ADD CASE")
- ### Set the geometry of the toplevel window
- addCaseWindow.geometry("360x230")
- addCaseWindow.resizable(0,0) # Make window unresizable
- ### Set the visual details of the toplevel window
- Label(addCaseWindow, text ="REQUIRED *", fg = "red", font='Helvetica 7',
- width=10, height=1).place(x=0,y=0)
- Label(addCaseWindow, text ="JURY", fg = "black", font='Helvetica 9',
- width=14, height=1).place(x=42,y=17)
- Label(addCaseWindow, text ="*", fg = "red", font='Helvetica 9',
- width=1, height=1).place(x=110,y=17)
- juryVar.set(" ") # Set the default value of dropdownmenu
- juryMenu = OptionMenu(addCaseWindow, juryVar, *jurysObjects)
- juryMenu.place(x=146, y=12) # Create a dropdown/option menu
- Label(addCaseWindow, text ="G.A.K. NUMBER", fg = "black", font='Helvetica 9',
- width=14, height=1).place(x=42,y=47)
- Label(addCaseWindow, text ="*", fg = "red", font='Helvetica 9',
- width=1, height=1).place(x=139,y=47)
- numberEntry = Entry(addCaseWindow, font='Helvetica 9')
- numberEntry.place(x=150, y=47)
- Label(addCaseWindow, text ="G.A.K. YEAR", fg = "black", font='Helvetica 9',
- width=14, height=1).place(x=42,y=77)
- Label(addCaseWindow, text ="*", fg = "red", font='Helvetica 9',
- width=1, height=1).place(x=128,y=77)
- yearEntry = Entry(addCaseWindow, font='Helvetica 9')
- yearEntry.place(x=150, y=77)
- Label(addCaseWindow, text ="UNIQUE NAME", fg = "black", font='Helvetica 9',
- width=14, height=1).place(x=42,y=107)
- nameEntry = Entry(addCaseWindow, font='Helvetica 9')
- nameEntry.place(x=150, y=107)
- Label(addCaseWindow, text ="NOTES", fg = "black", font='Helvetica 9',
- width=14, height=1).place(x=42,y=137)
- notesEntry = Entry(addCaseWindow, font='Helvetica 9')
- notesEntry.place(x=150, y=137)
- ### Create a function to retrieve the user's innput from the toplevel window
- def getValues():
- ### All these local variables are now stored to global variables so that they can be accessed by other functions
- global tmpJury
- global tmpNumber
- global tmpYear
- global tmpName
- global tmpNotes
- ### Retrive all the data that the user inputted in the entry variables using the .get() function from the Tkinter library
- tmpJury = juryVar.get()
- tmpNumber = numberEntry.get()
- tmpYear = yearEntry.get()
- tmpName = nameEntry.get()
- tmpNotes=notesEntry.get()
- ### Check whether the user has provided a sufficient input to all the required fields, if not show an error
- if tmpNumber == "":
- messagebox.showerror('BSB Error', 'Error: Please fill all the required fields!')
- elif tmpYear == "":
- messagebox.showerror('BSB Error', 'Error: Please fill all the required fields!')
- elif tmpJury == "":
- messagebox.showerror('BSB Error', 'Error: Please fill all the required fields!')
- else:
- addCaseWindow.destroy()
- inputData()
- ### Create the button that calls the getValues() function each time its pressed
- finalAdd = Button(addCaseWindow, text= "ADD CASE", bg="#636363", fg="black",
- activebackground="#535353", font='Helvetica 8', command = getValues).place(x=150, y=190)
- ### Create a button that call the acceptData function which opens the toplevel window in order for the client to enter the case's details and get the results
- addCase = Button(root, text ="ADD CASE", bg="#636363", fg="black", activebackground="#535353",
- font='Helvetica 8', command = acceptData).place(x=125, y=46.5)
- def delCaseDatabase():
- global tmpDelCase
- ### Delete a document from the mongoDB database based on wther the field uniqueName has the value tmpDelName
- coll.delete_one({"GAK NUMBER": str(tmpDelCase)})
- loadTrueCases()
- ### Create a function that inputs to the government's website the case's details, scrape the results, shwo them to the user and store them into the GUI's database
- def inputData():
- global combinedDetails
- global counter
- counter = counter + 1
- ### Setting up the webdriver and directing the service to its directory
- serv_obj=Service("C:\Drivers\chromedriver_win32\chromedriver.exe")
- driver = webdriver.Chrome(service=serv_obj)
- driver.get("https://extapps.solon.gov.gr/mojwp/faces/TrackLdoPublic")
- ### Locate the elements in the website and send the user’s data
- driver.find_element(By.NAME, "courtOfficeOC").send_keys(str(tmpJury))
- driver.find_element(By.NAME, "it1").send_keys(str(tmpNumber))
- driver.find_element(By.NAME, "it2").send_keys(str(tmpYear))
- driver.find_element(By.ID,"ldoSearch").click()
- time.sleep(10)
- ### Get the number of rows of the table I want to scrape info from
- rows = len (driver.find_elements(By.XPATH, '//*[@id="pc1:ldoTable::db"]/table/tbody/tr/td[2]/div/table/tbody/tr'))
- ### Get the number of columns of the table I want to scrape info from
- columns = len (driver.find_elements(By.XPATH, '//*[@id="pc1:ldoTable::db"]/table/tbody/tr/td[2]/div/table/tbody/tr/td'))
- ### Create the list that all the case's details are going to get in
- preDetailsList = []
- ### Get the structure of the XPath of the table I want to scrape in the goverments website in the case it has more than 1 row
- before_XPath = '//*[@id="pc1:ldoTable::db"]/table/tbody/tr/td[2]/div/table/tbody/tr['
- aftertd_XPath = ']/td['
- aftertr_XPath = "]"
- ### Get the structure of the XPath of the table I want to scrape in the goverments website in the case it has 1 row
- before_XPath2 = '//*[@id="pc1:ldoTable::db"]/table/tbody/tr/td[2]/div/table/tbody/tr/td['
- aftertr_XPath2 = "]"
- ### Check whether the table has more than one row and accordingly scrape the information
- if rows > 1:
- for t_row in range(1, (rows + 1)):
- for t_column in range(1, (columns + 1)):
- FinalXPath = before_XPath + str(t_row) + aftertd_XPath + str(t_column) + aftertr_XPath
- cell_text = driver.find_element(By.XPATH,FinalXPath).text
- preDetailsList.append(str(cell_text))
- else:
- for t_column in range(1, (columns + 1)):
- FinalXPath = before_XPath2 + str(t_column) + aftertr_XPath2
- cell_text = driver.find_element(By.XPATH,FinalXPath).text
- preDetailsList.append(str(cell_text))
- ### Close the browser
- driver.close()
- ### Create the string that all the cases info will be present
- combinedDetails = ''
- ### Add all the list's objects
- for detail in preDetailsList:
- combinedDetails += ' | ' + detail
- # ### Add this data into the list with all the cases
- # caseList.append(str(combinedDetails))
- ### Call the nessesary functions in order for the program to run efficiently
- inputDatabase()
- loadTrueCases()
- def deleteData():
- ### Create a new window (top-level) that is going to delete a case from the database
- deleteCaseWindow = Toplevel(root)
- ### Set the title of this toplevel window
- deleteCaseWindow.title("DELETE CASE")
- ### Set the geometry of the toplevel window
- deleteCaseWindow.geometry("360x230")
- deleteCaseWindow.resizable(0,0) # Make window unresizable
- ### Set the visual details of the toplevel window
- Label(deleteCaseWindow, text ="REQUIRED *", fg = "red", font='Helvetica 7',
- width=10, height=1).place(x=0,y=0)
- descr = Label(deleteCaseWindow, text ="Guide: Type the 'G.A.K. NUMBER' of the case \n"
- "you want to delete without misspellings.", fg = "black", font='Helvetica 9',
- width=100, height=2).place(x=-172,y=34)
- Label(deleteCaseWindow, text ="G.A.K. NUMBER", fg = "black", font='Helvetica 9',
- width=14, height=1).place(x=38,y=107)
- Label(deleteCaseWindow, text ="*", fg = "red", font='Helvetica 9',
- width=1, height=1).place(x=136,y=107)
- delGAKN = Entry(deleteCaseWindow, font='Helvetica 9')
- delGAKN.place(x=150, y=107)
- def getGAKNum():
- global tmpDelCase
- ### Retrive the data that the user inputted in the 'Unique Name' entry variable using the .get() function from the Tkinter library
- tmpDelCase = delGAKN.get()
- ### Check whether the user has provided a sufficient input to all the required fields, if not show an error
- if tmpDelCase == "":
- messagebox.showerror('BSB Error', 'Error: Please fill all the required fields!')
- else:
- deleteCaseWindow.destroy()
- delCaseDatabase()
- ### Create the button that calls the getValues() function each time its pressed
- finalDelete = Button(deleteCaseWindow, text= "DELETE CASE", bg="#636363", fg="black",
- activebackground="#535353", font='Helvetica 8', command = getGAKNum).place(x=150, y=150)
- ### Create a button that calls the deleteData function which deletes a case from the database by
- deleteCase = Button(root, text ="DELETE CASE", bg="#636363", fg="black", activebackground="#535353",
- font='Helvetica 8', command = deleteData).place(x=195, y=46.5)
- ### Create a function which renews the database in the root window with adding or deleting new cases
- def setListbox():
- global caseLB
- ### Create a scrollbar in the listbox to make the navigation of the cases easier
- my_scrollbar = Scrollbar(root, orient=HORIZONTAL)
- my_scrollbar.pack(side=BOTTOM, fill=X)
- ### Create a listbox with all the cases in the root window
- caseLB = Listbox(root, height=55, width=300, xscrollcommand = my_scrollbar.set)
- caseLB.place(x=0, y=86) # Place it in the correct position of the root window
- caseLB.pack(padx=10,pady=95,fill=BOTH, expand=True) # Adjust its size depending on the dimensions of my client's screen
- my_scrollbar.config(command=caseLB.xview)
- def inputDatabase():
- global combinedDetails
- ## Create and insert new dictionary
- newDict = {"GAK NUMBER":str(tmpNumber),"NAME":str(tmpName),"CASE DETAILS":combinedDetails,"NOTES":str(tmpNotes), "JURY":str(tmpJury), "YEAR":str(tmpYear)}
- try:
- coll.insert_one(newDict)
- except:
- pass
- def loadTrueCases():
- ### Delete all the cases in the listbox in order to fill it with only what is in the MongoDB database at the moment
- caseLB.delete(0, END)
- ### Call all the documents in the MongoDB database
- getColl = coll.find()
- for details in getColl: # Iterate through all the documents in the MongoDB database
- caseLB.insert(END, details) # Insert all the cases in the listbox
- ### Create a button that calls the loadTrueCases function which loads to the GUI all the cases (documents) that are in the database at the moment
- loadCase = Button(root, text ="LOAD CASE", bg="#636363", fg="black", activebackground="#535353",
- font='Helvetica 8', command = loadTrueCases).place(x=280, y=46.5)
- def updateCase():
- ### Call all the documents in the MongoDB database
- autoColl = coll.find()
- for details in autoColl: # Iterate through all the documents in the MongoDB database
- ### Get the info required from the MongoDB database in order to be able to search for the case in the governemnt's website
- updateJury = details["JURY"]
- updateNumber = details["GAK NUMBER"]
- updateYear = details["YEAR"]
- updateName = details["NAME"]
- updateDetails = details["CASE DETAILS"]
- updateNotes = details["NOTES"]
- ### Setting up the webdriver and directing the service to its directory
- serv_obj=Service("C:\Drivers\chromedriver_win32\chromedriver.exe")
- driver = webdriver.Chrome(service=serv_obj)
- driver.get("https://extapps.solon.gov.gr/mojwp/faces/TrackLdoPublic")
- ### Locate the elements in the website and send the user’s data
- driver.find_element(By.NAME, "courtOfficeOC").send_keys(str(updateJury))
- driver.find_element(By.NAME, "it1").send_keys(str(updateNumber))
- driver.find_element(By.NAME, "it2").send_keys(str(updateYear))
- driver.find_element(By.ID,"ldoSearch").click()
- time.sleep(10)
- ### Get the number of rows of the table I want to scrape info from
- rows = len (driver.find_elements(By.XPATH, '//*[@id="pc1:ldoTable::db"]/table/tbody/tr/td[2]/div/table/tbody/tr'))
- ### Get the number of columns of the table I want to scrape info from
- columns = len (driver.find_elements(By.XPATH, '//*[@id="pc1:ldoTable::db"]/table/tbody/tr/td[2]/div/table/tbody/tr/td'))
- ### Create the list that all the case's details are going to get in
- preDetailsList = []
- ### Get the structure of the XPath of the table I want to scrape in the goverments website in the case it has more than 1 row
- before_XPath = '//*[@id="pc1:ldoTable::db"]/table/tbody/tr/td[2]/div/table/tbody/tr['
- aftertd_XPath = ']/td['
- aftertr_XPath = "]"
- ### Get the structure of the XPath of the table I want to scrape in the goverments website in the case it has 1 row
- before_XPath2 = '//*[@id="pc1:ldoTable::db"]/table/tbody/tr/td[2]/div/table/tbody/tr/td['
- aftertr_XPath2 = "]"
- ### Check whether the table has more than one row and accordingly scrape the information
- if rows > 1:
- for t_row in range(1, (rows + 1)):
- for t_column in range(1, (columns + 1)):
- FinalXPath = before_XPath + str(t_row) + aftertd_XPath + str(t_column) + aftertr_XPath
- cell_text = driver.find_element(By.XPATH,FinalXPath).text
- preDetailsList.append(str(cell_text))
- else:
- for t_column in range(1, (columns + 1)):
- FinalXPath = before_XPath2 + str(t_column) + aftertr_XPath2
- cell_text = driver.find_element(By.XPATH,FinalXPath).text
- preDetailsList.append(str(cell_text))
- ### Close the browser
- driver.close()
- ### Create the string that all the cases info will be present
- combinedDetails = ''
- ### Add all the list's objects
- for detail in preDetailsList:
- combinedDetails += ' | ' + detail
- # newDict = {"GAK NUMBER":str(updateNumber),"NAME":str(updateName),"CASE DETAILS":combinedDetails,"NOTES":str(updateNotes), "JURY":str(updateJury), "YEAR":str(updateYear)}
- newDict = {"CASE DETAILS":combinedDetails}
- ### Check whether the old case's details are equal to the new cases details
- if combinedDetails != updateDetails:
- coll.update_one({'CASE DETAILS': updateDetails},{"$set":newDict}) # Update the database with the new details of the case
- ### Load the true cases in the GUI after the mass updating ends
- loadTrueCases()
- ### Create a button that inputs all the current cases in the MongoDB database to the governmnet's website and updates the results
- updateCase = Button(root, text ="UPDATE ALL", bg="#CC0000", fg="black", activebackground="#535353",
- font='Helvetica 8', command = updateCase).place(x=357, y=46.5)
- def completeAutomation():
- global updateFlag
- updateFlag = False
- def autoSearch():
- global updateFlag
- ### Call all the documents in the MongoDB database
- autoColl = coll.find()
- for details in autoColl: # Iterate through all the documents in the MongoDB database
- ### Get the info required from the MongoDB database in order to be able to search for the case in the governemnt's website
- autoJury = details["JURY"]
- autoNumber = details["GAK NUMBER"]
- autoYear = details["YEAR"]
- autoName = details["NAME"]
- autoDetails = details["CASE DETAILS"]
- autoNotes = details["NOTES"]
- ### Setting up the webdriver and directing the service to its directory
- serv_obj=Service("C:\Drivers\chromedriver_win32\chromedriver.exe")
- driver = webdriver.Chrome(service=serv_obj)
- driver.get("https://extapps.solon.gov.gr/mojwp/faces/TrackLdoPublic")
- ### Locate the elements in the website and send the user’s data
- driver.find_element(By.NAME, "courtOfficeOC").send_keys(str(autoJury))
- driver.find_element(By.NAME, "it1").send_keys(str(autoNumber))
- driver.find_element(By.NAME, "it2").send_keys(str(autoYear))
- driver.find_element(By.ID,"ldoSearch").click()
- time.sleep(10)
- ### Get the structure of the XPath of the table I want to scrape in the goverments website in the case it has more than 1 row
- before_XPath = '//*[@id="pc1:ldoTable::db"]/table/tbody/tr/td[2]/div/table/tbody/tr['
- aftertd_XPath = ']/td['
- aftertr_XPath = "]"
- ### Get the structure of the XPath of the table I want to scrape in the goverments website in the case it has 1 row
- before_XPath2 = '//*[@id="pc1:ldoTable::db"]/table/tbody/tr/td[2]/div/table/tbody/tr/td['
- aftertr_XPath2 = "]"
- ### Get the number of rows of the table I want to scrape info from
- rows = len (driver.find_elements(By.XPATH, '//*[@id="pc1:ldoTable::db"]/table/tbody/tr/td[2]/div/table/tbody/tr'))
- ### Get the number of columns of the table I want to scrape info from
- columns = len (driver.find_elements(By.XPATH, '//*[@id="pc1:ldoTable::db"]/table/tbody/tr/td[2]/div/table/tbody/tr/td'))
- ### Create the list that all the case's details are going to get in
- preDetailsList = []
- ### Check whether the table has more than one row and accordingly scrape the information
- if rows > 1:
- for t_row in range(1, (rows + 1)):
- for t_column in range(1, (columns + 1)):
- FinalXPath = before_XPath + str(t_row) + aftertd_XPath + str(t_column) + aftertr_XPath
- cell_text = driver.find_element(By.XPATH,FinalXPath).text
- preDetailsList.append(str(cell_text))
- else:
- for t_column in range(1, (columns + 1)):
- FinalXPath = before_XPath2 + str(t_column) + aftertr_XPath2
- cell_text = driver.find_element(By.XPATH,FinalXPath).text
- preDetailsList.append(str(cell_text))
- pinakiouXPath= '//*[@id="pc1:ldoTable::db"]/table/tbody/tr/td[2]/div/table/tbody/tr/td[6]'
- pinakiouInfo = driver.find_element(By.XPATH, pinakiouXPath).text
- apofasisXPath= '//*[@id="pc1:ldoTable::db"]/table/tbody/tr/td[2]/div/table/tbody/tr/td[7]'
- apofasisInfo = driver.find_element(By.XPATH, apofasisXPath).text
- apotelesmaXPath= '//*[@id="pc1:ldoTable::db"]/table/tbody/tr/td[2]/div/table/tbody/tr/td[8]'
- apotelesmaInfo = driver.find_element(By.XPATH, apotelesmaXPath).text
- ### Close the browser
- driver.close()
- ### Create the string that all the cases info will be present
- combinedDetails = ''
- ### Add all the list's objects
- for detail in preDetailsList:
- combinedDetails += ' | ' + detail
- newDict = {"CASE DETAILS":combinedDetails}
- if combinedDetails != autoDetails:
- coll.update_one({'CASE DETAILS': autoDetails},{"$set":newDict}) # Update the database with the new details of the case
- email_sender = '[email protected]'
- email_password = 'mtrouqobdtbqgaeq'
- email_receiver = '[email protected]'
- subjectString = 'Boutsioukis Solon Box | Πορεία Δικογραφίας [Αλλαγή πορείας υπόθεσης με Γ.Α.Κ. αριθμό: ' + str(autoNumber) + ']'
- subject = subjectString
- bodyString = 'Άλλαξε η πορεία της υπόθεσης' + str(autoName) + ' του καταστήματος: ' + str(autoJury) + ', με Γ.Α.Κ. αριθμό: ' + str(autoNumber) + ', και Γ.Α.Κ. έτος: ' + str(autoYear) + '\n\nΟ νέος Αριθμός Πινακίου είναι: ' + str(pinakiouInfo) +'\n\nΟ νέος Αριθμός Aπόφασης/Ετος - Είδος Διατακτικού είναι: '+ str(apofasisInfo) + '\n\nΤο νέο Αποτέλεσμα Συζήτησης είναι: ' + str(apotelesmaInfo)
- body = bodyString
- em = EmailMessage()
- em['From'] = email_sender
- em['To'] = email_receiver
- em['Subject'] = subject
- em.set_content(body)
- context = ssl.create_default_context()
- with smtplib.SMTP_SSL('smtp.gmail.com', 465, context=context) as smtp:
- smtp.login(email_sender, email_password)
- smtp.sendmail(email_sender, email_receiver, em.as_string())
- ### Schedule the function autoSearch to run every 1800 seconds
- schedule.every(50).seconds.do(autoSearch)
- while 1:
- schedule.run_pending()
- time.sleep(1)
- checkbox = Checkbutton(root, text='Activate Automate Search', command=completeAutomation)
- checkbox.deselect()
- checkbox.place(x=457, y=46.5)
- ### Call the nessesary functions in order for the program to run efficiently
- setListbox()
- loadTrueCases()
- root.mainloop()
Editor
You can edit this paste and save as new: