NDAR / nda-tools

Python package for interacting with NDA web services. Used to validate, submit, and download data to and from NDA.
MIT License
48 stars 22 forks source link

KeyError #45

Closed GerardYu closed 2 years ago

GerardYu commented 2 years ago

hi i tried to download a single file using example command downloadcmd s3://NDAR_Central_3/submission_33230/HCD0008117_V1_MR/T1w/T1w_acpc_dc_restore.nii.gz -u <your username> -p <your password> -d HCPDevImgManifestBehSingleLink from https://www.humanconnectome.org/storage/app/media/documentation/LS2.0/LS_Release_2.0_Access_Instructions_June2022.pdf and i got the error below.

Running NDATools Version 0.2.17

No value specified for --workerThreads. Using the default option of 31
Important - You can configure the thread count setting using the --workerThreads argument to maximize your download speed.

Getting Package Information...
Traceback (most recent call last):
  File "/home/junhong.yu/NDAenv/bin/downloadcmd", line 10, in <module>
    sys.exit(main())
  File "/home/junhong.yu/NDAenv/lib/python3.7/site-packages/NDATools/clientscripts/downloadcmd.py", line 197, in main
    s3Download.start()
  File "/home/junhong.yu/NDAenv/lib/python3.7/site-packages/NDATools/Download.py", line 191, in start
    package_resource = self.get_package_info()
  File "/home/junhong.yu/NDAenv/lib/python3.7/site-packages/NDATools/Download.py", line 952, in get_package_info
    tmp = get_request(url,headers=self.request_header(),auth=self.auth)
  File "/home/junhong.yu/NDAenv/lib/python3.7/site-packages/NDATools/Utils.py", line 289, in get_request
    error_handler(tmp)
  File "/home/junhong.yu/NDAenv/lib/python3.7/site-packages/NDATools/Utils.py", line 60, in print_and_exit
    if 'json' in r.headers['Content-Type']:
  File "/home/junhong.yu/NDAenv/lib/python3.7/site-packages/requests/structures.py", line 52, in __getitem__
    return self._store[key.lower()][1]
KeyError: 'content-type'
gregmagdits commented 2 years ago

It looks like you are missing the -dp argument, which is required. The value of the -dp argument is the package-id which contains your file. You should be able to see all of the package id's if you login to the NDA website and go to the packages dashboard.

GerardYu commented 2 years ago

yes it works now with the -dp parameter. thanks!