def get_data_from_BRD(): url = 'https://www.brd.ro/curs-valutar-si-dobanzi-de-referinta' driver.get(url) name = "BRD" nr = [2, 3, 4] for i in nr: x = driver.find_element_by_xpath( '//*[@id="tabAccountExchangeRates"]/div/div[2]/p[' + str(i) + ']').text y = driver.find_element_by_xpath( '//*[@id="tabAccountExchangeRates"]/div/div[4]/p[' + str(i) + ']').text z = driver.find_element_by_xpath( '//*[@id="tabAccountExchangeRates"]/div/div[5]/p[' + str(i) + ']').text bkdb.insert(name, x, y, z, cr_data) r = requests.get(url) c = r.content soup = BeautifulSoup(c, "html.parser") all = soup.find_all("div", {"class": "col-sm-2 hidden-xs"}) x = all[2].text.replace("\n", "")[43:46] all1 = soup.find_all("div", {"class": "col-xs-4 col-sm-2"}) y = all1[0].text.replace(" ", "").replace("\n", "")[79:85] z = all1[1].text.replace(" ", "").replace("\n", "")[79:85] bkdb.insert(name, x, y, z, cr_data)
def insert_command(): bkdb.insert(nume_text.get(), firma_produs_text.get(), unitate_text.get(), nr_bucati_text.get(), pret_text.get()) tree.insert("", tk.END, values=(nume_text.get(), firma_produs_text.get(), unitate_text.get(), nr_bucati_text.get(), pret_text.get())) clear_text()
def get_data_from_Raiffeisen(): driver.get('https://www.raiffeisen.ro/persoane-fizice/curs-valutar/') name = 'Raiffeisen' nr = [0, 1, 2, 3] for i in nr: x = driver.find_element_by_xpath('//*[@id="_' + str(i) + '"]/td[2]').text y = driver.find_element_by_xpath('//*[@id="_' + str(i) + '"]/td[4]').text z = driver.find_element_by_xpath('//*[@id="_' + str(i) + '"]/td[5]').text bkdb.insert(name, x, y, z, cr_data)
def get_data_from_Unicredit(): driver.get( 'https://www.unicredit.ro/ro/institutional/Diverse/SchimbValutar.html') name = "Unicredit" nr = [1, 2, 6, 10] for i in nr: x = driver.find_element_by_xpath('//*[@id="currency_list_table"]/tr[' + str(i) + ']/td[1]/a/strong').text y = driver.find_element_by_xpath('//*[@id="currency_list_table"]/tr[' + str(i) + ']/td[3]/div').text z = driver.find_element_by_xpath('//*[@id="currency_list_table"]/tr[' + str(i) + ']/td[4]/div').text bkdb.insert(name, x, y, z, cr_data)
def get_data_fom_BT(): driver.get('https://www.bancatransilvania.ro/curs-valutar-spot/') name = "BT" nr = [1, 2, 3, 4] for i in nr: x = driver.find_element_by_xpath( '/html/body/section/div[1]/div[2]/table[2]/tbody/tr[' + str(i) + ']/td[1]/span').text y = driver.find_element_by_xpath( '/html/body/section/div[1]/div[2]/table[2]/tbody/tr[' + str(i) + ']/td[3]').text z = driver.find_element_by_xpath( '/html/body/section/div[1]/div[2]/table[2]/tbody/tr[' + str(i) + ']/td[4]').text bkdb.insert(name, x, y, z, cr_data)
def get_data_fom_ING(): r = requests.get( "https://ing.ro/ing-in-romania/informatii-utile/curs-valutar") c = r.content soup = BeautifulSoup(c, "html.parser") monede = ["EUR", "USD", "GBP", "CHF"] name = "ING" i = 0 for md in monede: all = soup.find_all("td", {"class": "buy", "data-currency": md}) y = all[1].text.replace(" ", "").replace("\n", "") all1 = soup.find_all("td", {"class": "sell", "data-currency": md}) z = all1[1].text.replace(" ", "").replace("\n", "") all2 = soup.find_all("td", {"class": "code"}) x = all2[i].text.replace(" ", "").replace("\n", "") bkdb.insert(name, x, y, z, cr_data) i += 1
def get_data_fom_BCR(): driver.get('https://www.bcr.ro/ro/curs-valutar') nr = [1, 2, 3, 4] name = "BCR" for i in nr: print(i) x = driver.find_element_by_xpath( '//*[@id="content"]/div[5]/div/div/div/div/div[1]/div/div/div/table/tbody/tr[' + str(i) + ']/td[2]').text print( driver.find_element_by_xpath( '/html/body/div[3]/main/div[5]/div/div/div/div/div[1]/div/div/div/table/tbody/tr[1]/td[3]' )) y = driver.find_element_by_xpath( '//*[@id="content"]/div[5]/div/div/div/div/div[1]/div/div/div/table/tbody/tr[' + str(i) + ']/td[3]').text print(y) z = driver.find_element_by_xpath( '//*[@id="content"]/div[5]/div/div/div/div/div[1]/div/div/div/table/tbody/tr[' + str(i) + ']/td[4]').text print(z) bkdb.insert(name, x, y, z, cr_data)