Skip to content
This repository has been archived by the owner on Nov 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #42 from lincbrain/ak-auth-move
Browse files Browse the repository at this point in the history
Include logic to properly authenticate a user upon the move command
  • Loading branch information
aaronkanzer authored Apr 10, 2024
2 parents 9ad0699 + 40a8c76 commit 5995675
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lincbrain/move.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,10 @@ def move(
if dandiset is None:
dandiset = Path()
with ExitStack() as stack:
client = DandiAPIClient.for_dandi_instance(dandi_instance)
client.dandi_authenticate()
stack.enter_context(client)

mover: Mover
client: DandiAPIClient | None = None
if work_on is MoveWorkOn.AUTO:
Expand All @@ -811,8 +815,6 @@ def move(
if isinstance(dandiset, str):
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)
stack.enter_context(client)
remote_ds = client.get_dandiset(
local_ds.identifier, version_id="draft", lazy=False
)
Expand All @@ -833,15 +835,14 @@ 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
remote_ds = rds
subpath = Path()
else:
local_ds, subpath = find_dandiset_and_subpath(dandiset)
client = DandiAPIClient.for_dandi_instance(dandi_instance)
stack.enter_context(client)
remote_ds = client.get_dandiset(
local_ds.identifier, version_id="draft", lazy=False
)
Expand Down

0 comments on commit 5995675

Please sign in to comment.