parent
394b19ce17
commit
ebb72cb845
|
@ -12,7 +12,8 @@ from tkinter import filedialog
|
||||||
import time
|
import time
|
||||||
from selenium.webdriver.common.action_chains import ActionChains
|
from selenium.webdriver.common.action_chains import ActionChains
|
||||||
|
|
||||||
DropDownLabels = ["Street: ", "Number: ", "Postal code: ", "City: ", "Sonnendach URL: ", "Suitability", "Image Filename Map: ", "Image Filename Production: ", "Image Filename qrcode: ", "PV Production 50", "PV Production 75", "PV Production 100", "Value Electricity production"]
|
create_images = True
|
||||||
|
DropDownLabels = ["Street: ", "Number: ", "Postal code: ", "City: ", "Sonnendach URL: ", "Suitability", "Image Filename Map: ", "Image Filename Production: ", "Image Filename qrcode: ", "PV Production 50", "PV Production 75", "PV Production 100", "Value Electricity production", "Roof area"]
|
||||||
file_split_char = ","
|
file_split_char = ","
|
||||||
OptionList = []
|
OptionList = []
|
||||||
exit = False
|
exit = False
|
||||||
|
@ -41,8 +42,9 @@ def search_adresses(adress_list, filename_adresslist, driver, mainText):
|
||||||
if (not os.path.exists("qrcodes")):
|
if (not os.path.exists("qrcodes")):
|
||||||
os.makedirs("qrcodes", exist_ok=False)
|
os.makedirs("qrcodes", exist_ok=False)
|
||||||
|
|
||||||
|
address_count = len(adress_list)
|
||||||
#Search for each adress in the list and create screenshots and qrcodes
|
#Search for each adress in the list and create screenshots and qrcodes
|
||||||
for i in range(len(adress_list)):
|
for i in range(address_count):
|
||||||
line = adress_list[i]
|
line = adress_list[i]
|
||||||
adress = line.split(file_split_char)
|
adress = line.split(file_split_char)
|
||||||
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)):
|
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)):
|
||||||
|
@ -71,7 +73,9 @@ def search_adresses(adress_list, filename_adresslist, driver, mainText):
|
||||||
pv_Production75 = driver.find_element(By.ID, "pv75").text.replace("'", "")
|
pv_Production75 = driver.find_element(By.ID, "pv75").text.replace("'", "")
|
||||||
pv_Production100 = driver.find_element(By.ID, "pv100").text.replace("'", "")
|
pv_Production100 = driver.find_element(By.ID, "pv100").text.replace("'", "")
|
||||||
value_electricity_production = driver.find_elements(By.XPATH, "//h2[@id='TitelSolarstrom']//strong")[2].text.replace("'", "").replace(" Franken", "")
|
value_electricity_production = driver.find_elements(By.XPATH, "//h2[@id='TitelSolarstrom']//strong")[2].text.replace("'", "").replace(" Franken", "")
|
||||||
|
roof_area = driver.find_element(By.ID, "areaOutput")
|
||||||
|
|
||||||
|
if(create_images):
|
||||||
|
|
||||||
image_filename = suitability + " - " + search_string
|
image_filename = suitability + " - " + search_string
|
||||||
image_folder_map = "screenshots/"
|
image_folder_map = "screenshots/"
|
||||||
|
@ -131,7 +135,13 @@ def search_adresses(adress_list, filename_adresslist, driver, mainText):
|
||||||
except:
|
except:
|
||||||
image_filename_production = "not-found"
|
image_filename_production = "not-found"
|
||||||
|
|
||||||
print(image_filename_map + " was saved.")
|
else:
|
||||||
|
image_filename_map = "not created"
|
||||||
|
image_filename_production = "not created"
|
||||||
|
image_filename_qrcode = "not created"
|
||||||
|
|
||||||
|
print("saved Address: " + search_string)
|
||||||
|
print("Address " + str(i) + " of " + str(address_count))
|
||||||
else:
|
else:
|
||||||
url = "not-found"
|
url = "not-found"
|
||||||
suitability = "not-found"
|
suitability = "not-found"
|
||||||
|
@ -142,6 +152,7 @@ def search_adresses(adress_list, filename_adresslist, driver, mainText):
|
||||||
pv_Production75 = "not-found"
|
pv_Production75 = "not-found"
|
||||||
pv_Production100 = "not-found"
|
pv_Production100 = "not-found"
|
||||||
value_electricity_production = "not-found"
|
value_electricity_production = "not-found"
|
||||||
|
roof_area = "not-found"
|
||||||
|
|
||||||
|
|
||||||
print("not found: " + search_string)
|
print("not found: " + search_string)
|
||||||
|
@ -157,6 +168,7 @@ def search_adresses(adress_list, filename_adresslist, driver, mainText):
|
||||||
adress[columnIndexes[10]] = pv_Production75
|
adress[columnIndexes[10]] = pv_Production75
|
||||||
adress[columnIndexes[11]] = pv_Production100
|
adress[columnIndexes[11]] = pv_Production100
|
||||||
adress[columnIndexes[12]] = value_electricity_production
|
adress[columnIndexes[12]] = value_electricity_production
|
||||||
|
adress[columnIndexes[13]] = roof_area
|
||||||
adress_file = open(filename_adresslist, "w", encoding="utf-8")
|
adress_file = open(filename_adresslist, "w", encoding="utf-8")
|
||||||
new_line_string = ""
|
new_line_string = ""
|
||||||
for j in adress:
|
for j in adress:
|
||||||
|
@ -178,7 +190,6 @@ def search_adresses(adress_list, filename_adresslist, driver, mainText):
|
||||||
print("closing Thread")
|
print("closing Thread")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
def read_adresslist(filename_adresslist):
|
def read_adresslist(filename_adresslist):
|
||||||
returnvalues = []
|
returnvalues = []
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue