-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathget_token.py
More file actions
42 lines (34 loc) · 1.26 KB
/
get_token.py
File metadata and controls
42 lines (34 loc) · 1.26 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import argparse
from methods.shared.common import get_auth
def parse_args():
parser = argparse.ArgumentParser(description="Generate a CIS2 authentication token.")
parser.add_argument(
"--user",
choices=["dispenser", "practitioner"],
help="User (dispenser or practitioner)",
)
parser.add_argument(
"--env",
choices=[
"INTERNAL-DEV-SANDBOX",
"SANDBOX",
"INT",
"INTERNAL-QA",
"INTERNAL-DEV",
"REF",
],
help="Env (INTERNAL-DEV-SANDBOX, SANDBOX, INT, INTERNAL-QA, INTERNAL-DEV, REF)",
)
return parser.parse_args()
if __name__ == "__main__":
args = parse_args()
print(
"This tool will allow you to generate a CIS2 authentication token. You can use this token to authenticate"
" with APIs that support this service."
)
print("Please ensure the appropriate environment variables are set: CLIENT_ID, CLIENT_SECRET")
if not args.user:
args.user = input("User (dispenser or practitioner): ")
if not args.env:
args.env = input("Env (INTERNAL-DEV-SANDBOX, SANDBOX, INT, INTERNAL-QA, INTERNAL-DEV, REF): ")
print(get_auth(env=args.env.upper(), product="EPS-FHIR", user=args.user.lower()))