dvolgyes / zenodo_get

Zenodo_get: Downloader for Zenodo records
GNU Affero General Public License v3.0
136 stars 21 forks source link

restricted repositories can't be used as download target #18

Closed jkabisch closed 1 year ago

jkabisch commented 1 year ago

Thank you very much for your excellent tool! I need to download files from repositories with restricted access. I cannot find a way to provide a private token to zenodo_get.

Expected behavior:

https://zenodo.org/record/8039248?token=eyJhbGciOiJIUzUxMiIsImV4cCI6MTY4OTQ1

Observed behavior:

./zenodo_get -r 8039248?token=eyJhbGciOiJIUzUxMiIsImV4cCI6MTY4OTQ1 Traceback (most recent call last): File "/home/jfk/.local/bin/./zenodo_get", line 8, in <module> sys.exit(zenodo_get()) File "/home/jfk/.local/lib/python3.10/site-packages/zenodo_get/zget.py", line 297, in zenodo_get files = js['files'] KeyError: 'files'

dvolgyes commented 1 year ago

Hi,

Indeed, private repositories were not implemented. I will try to take a look into it in the next days.

jkabisch commented 1 year ago

Thank you. Here is a link to a restricted repo with some random files. simply request access if this helps you:

https://zenodo.org/record/8045975

ricardobarroslourenco commented 1 year ago

It would be a great enhancement.

dvolgyes commented 1 year ago

I didn't have time before, but now it should work. You need to create a personal access token, and use that to access the files, something like: zenodo_get -r 8039248 -a TOKEN (I tried the above token, but didn't work for me, but when I created my own token for my own private data, then it works.)

The record?token= format is a bit messy, I didn't have much time to fix it, so maybe in the future, but for now '-a' should work. I pushed the new version to pypi, so you don't have to clone the repository. Let me know if it works or not.

dvolgyes commented 1 year ago

Probably works. :)