64 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			64 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Python
		
	
	
	
	
	
| #maybe need to import selenium here as well since selenium-webbrowser container connects to here
 | |
| from selenium import webdriver
 | |
| from selenium.common.exceptions import NoSuchElementException
 | |
| import numpy as np
 | |
| import pandas as pd
 | |
| 
 | |
| 
 | |
| #import extracting Dobby databank
 | |
| import source.Dobby.Dobby as Dobby
 | |
| 
 | |
| 
 | |
| '''
 | |
| get all Dobby data
 | |
| '''
 | |
| def main():
 | |
|     #Dobby.testDriver()
 | |
|     driver = Dobby.getDriver()
 | |
|     ppiXGroupNames = Dobby.findGroupNames(driver)
 | |
|     np.savetxt("/var/lib/data/test.txt", [1, 2], delimiter=",", fmt='%s')
 | |
|     print(ppiXGroupNames)
 | |
| 
 | |
|     #newDriver = Dobby.getDriver()
 | |
|     persons = Dobby.getPersons(driver, ppiXGroupNames)
 | |
|     print(persons)
 | |
|     
 | |
| 
 | |
|     mitarbeiterAnzahl = len(persons)
 | |
|     print("Anzahl der Mitarbeiter: " + str(mitarbeiterAnzahl))
 | |
|     personsArray = np.array(list(persons))
 | |
|     #print(personsArray)
 | |
|     personsArrayTrans = personsArray.transpose()
 | |
|     #print(personsArrayTrans)
 | |
|     
 | |
| 
 | |
|     allNumbers = Dobby.getDobbyPersonData(driver, personsArray)
 | |
|     print(allNumbers)
 | |
|     allNumbersTransposed = allNumbers.transpose()
 | |
| 
 | |
|     #TODO: solve that I only use one driver and never close it
 | |
|     driver.close()
 | |
| 
 | |
|     dictDobby = {'kuerzel': personsArrayTrans[0], 'name': personsArrayTrans[1], 'mobile': allNumbersTransposed[0]}
 | |
|     print(dictDobby)
 | |
|     dataframeDobby = pd.DataFrame.from_dict(dictDobby)
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
|     dataframeDobby.to_csv('/var/lib/data/fullDobby.csv', index=False)
 | |
|     np.savetxt("/var/lib/data/personsDobby.csv", personsArray, delimiter=",", fmt='%s')
 | |
| #TODO: also have to save it as csv file
 | |
| 
 | |
| 
 | |
| if __name__ == '__main__':
 | |
|     main()
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 | |
| 
 |