Skip to content

call dandi inside python script #76

Answered by satra
ahwillia asked this question in Q&A
Discussion options

You must be logged in to vote

here is an example:

from dandi.dandiapi import DandiAPIClient
from pathlib import Path

api = DandiAPIClient("https://api.dandiarchive.org/api")
ds = api.get_dandiset("000140")
for asset in ds.get_assets(order="path"):
    break
Path(asset.path).parent.mkdir()
asset.download(asset.path)

for full reference of asset see: https://dandi.readthedocs.io/en/latest/modref/dandiapi.html#dandi.dandiapi.BaseRemoteAsset.download

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@ahwillia
Comment options

Answer selected by ahwillia
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants