From 9af7226419c983c8334c67b97803a4ae2cdef925 Mon Sep 17 00:00:00 2001 From: "John T. Wodder II" Date: Fri, 9 Aug 2024 08:32:53 -0400 Subject: [PATCH] move: Immediately authenticate client after creation In order to deal with embargoed Dandisets --- dandi/move.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dandi/move.py b/dandi/move.py index 9996212bb..e53991e43 100644 --- a/dandi/move.py +++ b/dandi/move.py @@ -812,6 +812,7 @@ def move( raise TypeError("`dandiset` must be a Path when work_on='both'") local_ds, subpath = find_dandiset_and_subpath(dandiset) client = DandiAPIClient.for_dandi_instance(dandi_instance) + client.dandi_authenticate() stack.enter_context(client) remote_ds = client.get_dandiset( local_ds.identifier, version_id="draft", lazy=False @@ -833,6 +834,7 @@ def move( if not isinstance(url, DandisetURL): raise ValueError("URL does not point to a Dandiset") client = url.get_client() + client.dandi_authenticate() stack.enter_context(client) rds = url.get_dandiset(client, lazy=False) assert rds is not None @@ -841,6 +843,7 @@ def move( else: local_ds, subpath = find_dandiset_and_subpath(dandiset) client = DandiAPIClient.for_dandi_instance(dandi_instance) + client.dandi_authenticate() stack.enter_context(client) remote_ds = client.get_dandiset( local_ds.identifier, version_id="draft", lazy=False @@ -866,8 +869,6 @@ def move( if not plan: lgr.info("Nothing to move") return - if not dry_run and client is not None: - client.dandi_authenticate() if devel_debug: for gen in mover.process_moves_debug(plan, dry_run): for r in gen: