Skip to content

Commit 8dbca06

Browse files
authored
feat(cli): default login URL scheme http:// (#153)
1 parent fb458c7 commit 8dbca06

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cryosparc/cli.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import hashlib
22
import os
3+
import re
34
import sys
45
from argparse import ArgumentParser, ArgumentTypeError, Namespace
56
from datetime import datetime, timedelta, timezone
@@ -61,6 +62,12 @@ def login(args: Namespace):
6162
if not args.password:
6263
args.password = getpass("Password: ")
6364

65+
if not args.url:
66+
print("Error: CryoSPARC URL is required!", file=sys.stderr)
67+
os._exit(1)
68+
if not re.match(r"^https?://", args.url):
69+
args.url = "http://" + args.url
70+
6471
sessions = InstanceAuthSessions.load()
6572

6673
expiration_date = (datetime.now() + timedelta(seconds=expires_in)).replace(microsecond=0)

0 commit comments

Comments
 (0)