I need to login to a webpage using selenium webdriver to download some PDFs, for this I need to use 2 sets of credentials that i need to pass as plaintext.
What would be the best way to do this without hardcoding the passwords?
i was hardcoding everything like this:
if __name__ == '__main__':
ooffice=[SECRET EXPUNGED]
luser=[SECRET EXPUNGED]
lpassword=[SECRET EXPUNGED]
muser=[SECRET EXPUNGED]
mpassword=[SECRET EXPUNGED]
logname="log.txt"
today=datetime.datetime.now()
with open(logname, 'a+') as f:
f.write("{}: program started \n".format(datetime.datetime.now()))
for i in range(3):
try:
with open(logname, 'a') as f:
f.write("{}: downloading first document, try:{} \n".format(datetime.datetime.now(),i+1))
simpledownload(ooffice,luser,lpassword)
break
except Exception as Argument:
with open(logname, 'a') as f:
f.write(str(Argument))
f.write("\n")
for i in range(3):
try:
simpledownload(ooffice,muser,mpassword)
with open(logname, 'a') as f:
f.write("{}: downloading second document, try:{} \n".format(datetime.datetime.now(),i+1))
break
except Exception as Argument:
with open('output.txt', 'a') as f:
f.write(str(Argument))
f.write("\n")