-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
26 lines (23 loc) · 1.11 KB
/
setup.py
File metadata and controls
26 lines (23 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import sys
import argparse
import configparser
parser = argparse.ArgumentParser(prog=
'Setup configuration file',
description=
"Please enter all arguments in one command. "
"Reset arguments by running this program again."
)
parser.add_argument('-e', '--exec_path', help='Set chromedriver executable full file path')
parser.add_argument('-r', '--root_path', help="Set semester's download full file path")
parser.add_argument('-u', '--username', help='Set username')
parser.add_argument('-p', '--password', help='Set password')
args = parser.parse_args()
all_arguments_specified = len(sys.argv) == 9
assert all_arguments_specified, 'All arguments are required for the setup'
config = configparser.ConfigParser()
config['SETTINGS'] = {'EXEC_PATH': args.exec_path,
'ROOT_PATH': args.root_path,
'USERNAME': args.username,
'PASSWORD': args.password}
with open('config.ini', 'w') as f:
config.write(f)