diff options
| author | Teddy Wing | 2018-02-04 04:13:44 +0100 |
|---|---|---|
| committer | Teddy Wing | 2018-02-04 04:13:44 +0100 |
| commit | 0d46ecb4ebb7e7fd74576ac84675b40a6e7918ec (patch) | |
| tree | 00713b3d4a98fee13303fa51e767e9e607068cd2 | |
| parent | c0a814f892ef389cc708df12d1107b0d4b8cdcea (diff) | |
| download | harvester-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.py | 7 |
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.') |
