-
Notifications
You must be signed in to change notification settings - Fork 0
/
authenticate.py
37 lines (26 loc) · 994 Bytes
/
authenticate.py
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
27
28
29
30
31
32
33
34
35
36
37
"""Notifihub Authenticate
Manage athentication details for given connector. Beware that resulting
credentials are then stored in plaintext in config directory.
Multiple connections can be created for the same connector by passing the label
option.
Usage:
authenticate.py create <connector> [-l <connection_label>]
authenticate.py delete <connector> [-l <connection_label>]
authenticate.py (-h | --help)
Options:
-l, --label=<connection_label> Custom label for this connection [default: default]
"""
from docopt import docopt
from lib.manager import get_connector
from lib import config
def main(args):
config.load_config()
if (args['create']):
con = get_connector(args['<connector>'])
auth = con.authenticate()
config.write_auth(args['<connector>'], args['--label'], auth)
elif (args['delete']):
config.remove_auth(args['<connector>'], args['--label'])
if __name__ == '__main__':
args = docopt(__doc__)
main(args)