Skip to content

Commit 5faa18a

Browse files
authored
Merge pull request #1480 from dandi/move-auth
move: Immediately authenticate client after creation
2 parents e861149 + 9af7226 commit 5faa18a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

dandi/move.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,7 @@ def move(
812812
raise TypeError("`dandiset` must be a Path when work_on='both'")
813813
local_ds, subpath = find_dandiset_and_subpath(dandiset)
814814
client = DandiAPIClient.for_dandi_instance(dandi_instance)
815+
client.dandi_authenticate()
815816
stack.enter_context(client)
816817
remote_ds = client.get_dandiset(
817818
local_ds.identifier, version_id="draft", lazy=False
@@ -833,6 +834,7 @@ def move(
833834
if not isinstance(url, DandisetURL):
834835
raise ValueError("URL does not point to a Dandiset")
835836
client = url.get_client()
837+
client.dandi_authenticate()
836838
stack.enter_context(client)
837839
rds = url.get_dandiset(client, lazy=False)
838840
assert rds is not None
@@ -841,6 +843,7 @@ def move(
841843
else:
842844
local_ds, subpath = find_dandiset_and_subpath(dandiset)
843845
client = DandiAPIClient.for_dandi_instance(dandi_instance)
846+
client.dandi_authenticate()
844847
stack.enter_context(client)
845848
remote_ds = client.get_dandiset(
846849
local_ds.identifier, version_id="draft", lazy=False
@@ -866,8 +869,6 @@ def move(
866869
if not plan:
867870
lgr.info("Nothing to move")
868871
return
869-
if not dry_run and client is not None:
870-
client.dandi_authenticate()
871872
if devel_debug:
872873
for gen in mover.process_moves_debug(plan, dry_run):
873874
for r in gen:

0 commit comments

Comments
 (0)