Skip to content

Commit 9ed4772

Browse files
committed
fix: remove check for CRYOSPARC_LICENSE_ID env var
There was never a feature where you only specify this. You always had to specify it with a username and password, which is all we need now anyway
1 parent 489fe83 commit 9ed4772

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

cryosparc/tools.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,19 +154,16 @@ def __init__(
154154
host: Optional[str] = os.getenv("CRYOSPARC_MASTER_HOSTNAME"),
155155
base_port: Union[int, str, None] = os.getenv("CRYOSPARC_BASE_PORT"),
156156
email: Optional[str] = os.getenv("CRYOSPARC_EMAIL"),
157-
license: Optional[str] = os.getenv("CRYOSPARC_LICENSE_ID"),
158157
password: Optional[str] = os.getenv("CRYOSPARC_PASSWORD"),
158+
license: Optional[str] = None,
159159
timeout: int = 300,
160160
):
161161
if license:
162162
warnings.warn(
163-
"Support for license argument and CRYOSPARC_LICENSE_ID environment variable "
164-
"will be removed in a future release",
163+
"Support for license argument will be removed in a future release",
165164
DeprecationWarning,
166165
stacklevel=2,
167166
)
168-
if not LICENSE_REGEX.fullmatch(license):
169-
raise ValueError(f"Invalid CryoSPARC license ID {license}")
170167

171168
if host and base_port:
172169
if base_url:
@@ -180,15 +177,15 @@ def __init__(
180177
auth = None
181178
if email and password:
182179
auth = (email, sha256(password.encode()).hexdigest())
183-
elif license:
184-
auth = ("cryosparc", sha256(license.encode()).hexdigest())
185180
elif session := InstanceAuthSessions.load().find(self.base_url, email):
186181
auth = session.token.access_token
182+
elif license:
183+
auth = ("cryosparc", sha256(license.encode()).hexdigest())
187184
else:
188185
raise ValueError(
189186
f"CryoSPARC authentication not provided or expired for {self.base_url}. "
190187
"If required, create a new session with command\n\n"
191-
" python -m cryosparc.tools login\n\n"
188+
" python3 -m cryosparc.tools login\n\n"
192189
"Please see documentation at https://tools.cryosparc.com for instructions."
193190
)
194191

0 commit comments

Comments
 (0)