aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2018-02-04 04:13:44 +0100
committerTeddy Wing2018-02-04 04:13:44 +0100
commit0d46ecb4ebb7e7fd74576ac84675b40a6e7918ec (patch)
tree00713b3d4a98fee13303fa51e767e9e607068cd2
parentc0a814f892ef389cc708df12d1107b0d4b8cdcea (diff)
downloadharvester-submit-week-for-approval-0d46ecb4ebb7e7fd74576ac84675b40a6e7918ec.tar.bz2
Add `get_password`
Make a function that will get a password string given a shell command. This allows us to pass a command to the program instead of a clear text password.
-rw-r--r--harvester_submit_week_for_approval.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/harvester_submit_week_for_approval.py b/harvester_submit_week_for_approval.py
index 10d8dd9..77e0665 100644
--- a/harvester_submit_week_for_approval.py
+++ b/harvester_submit_week_for_approval.py
@@ -2,6 +2,7 @@
import argparse
from datetime import datetime, timedelta
+import subprocess
from selenium.webdriver import Firefox
from selenium.webdriver.common.by import By
@@ -80,6 +81,12 @@ def submit_week_for_approval(driver, wait):
return driver
+def get_password(command):
+ result = subprocess.run(['sh', '-c', command], stdout=subprocess.PIPE)
+
+ return str(result.stdout, 'utf-8').rstrip()
+
+
if __name__ == "__main__":
parser = argparse.ArgumentParser(
description='Submit the most recent Harvest timesheet for approval.')