added check if adress has empty fields. (Street, Number, Postal Code, City) Skip adress if one of those fields is empty.
This commit is contained in:
parent
7a3ba625d3
commit
58bb85660a
9
Main.py
9
Main.py
|
@ -20,8 +20,8 @@ stopThread = False
|
|||
filename_adresslist = ""
|
||||
adresslist = ""
|
||||
step = 0
|
||||
s = Service(ChromeDriverManager().install())
|
||||
driver = webdriver.Chrome(service=s)
|
||||
service = Service(ChromeDriverManager().install())
|
||||
driver = webdriver.Chrome(service=service)
|
||||
driver.minimize_window()
|
||||
outputtext = "Welcome to application Sonnendach\n"
|
||||
columnIndexes = []
|
||||
|
@ -33,15 +33,17 @@ def search_adresses(adress_list, filename_adresslist, driver):
|
|||
global stopThread
|
||||
global columnIndexes
|
||||
|
||||
#Create Direcotrys to save screenshots and qrcodes if they don't exist yet.
|
||||
if(not os.path.exists("screenshots")):
|
||||
os.makedirs("screenshots", exist_ok=False)
|
||||
if (not os.path.exists("qrcodes")):
|
||||
os.makedirs("qrcodes", exist_ok=False)
|
||||
|
||||
#Search for each adress in the list and create screenshots and qrcodes
|
||||
for i in range(len(adress_list)):
|
||||
line = adress_list[i]
|
||||
adress = line.split(file_split_char)
|
||||
if((line != adress_list[0]) & ((adress[columnIndexes[4]] == ""))):
|
||||
if((line != adress_list[0]) & (adress[columnIndexes[4]] == "") & (len((adress[columnIndexes[0]]) > 0)) & (len(adress[columnIndexes[1]] > 0)) & (len(adress[columnIndexes[2]] > 0)) & (len(adress[columnIndexes[3]] > 0))):
|
||||
print(adress)
|
||||
search_string = adress[columnIndexes[0]] + " " + adress[columnIndexes[1]] + " " + adress[columnIndexes[2]] + " " + adress[columnIndexes[3]]
|
||||
search_bar = driver.find_element(By.ID, "searchTypeahead1")
|
||||
|
@ -61,7 +63,6 @@ def search_adresses(adress_list, filename_adresslist, driver):
|
|||
|
||||
if(found):
|
||||
time.sleep(2)
|
||||
# TODO: Validation
|
||||
url = driver.current_url
|
||||
eignung = driver.find_element(By.ID, "eignung").text
|
||||
pv_Production50 = driver.find_element(By.ID, "pv50").text.replace("'", "")
|
||||
|
|
|
@ -10,11 +10,11 @@ print("select Directory:")
|
|||
filename_Directory = filedialog.askdirectory()
|
||||
root.withdraw
|
||||
print(filename_Directory)
|
||||
adress_file = open(filename_Filelist, "r", encoding='utf-8')
|
||||
adress_file = open(filename_Filelist, "r")
|
||||
address_list = adress_file.read().splitlines()
|
||||
|
||||
for adress in address_list:
|
||||
filenames = adress.split(";")
|
||||
filenames = adress.split(",")
|
||||
try:
|
||||
os.rename(filename_Directory + "/" + filenames[0], filename_Directory + "/" + filenames[1])
|
||||
except:
|
||||
|
|
Loading…
Reference in New Issue