-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
auto-import from our Zenodo community #114
base: main
Are you sure you want to change the base?
Conversation
Interesting, the auto-importer added duplicate entries. Read details here: |
I also see it |
I just merged #113 . It is possible that then tests pass here. |
Ok, this didn't help. I presume we need to identify DOI-links for each zenodo link, before adding the zenodo-link to our list. It is possible that we have the corresponding DOI link in our list and that's why the duplication-checker raises an error. It might make sense to clean up the code a bit in advance. |
"token = os.getenv('ZENODO_API_KEY')\n", | ||
"community = 'nfdi4bioimage'\n", | ||
"\n", | ||
"response = requests.get('https://zenodo.org/api/records',\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be no theoretical error. What about add some error test like API rate limits, or other HTTP-related errors?
maybe like:
try:
response = requests.get('https://zenodo.org/api/records',
params={'communities': community,
'access_token': token})
# Raises an HTTPError for bad responses
response.raise_for_status()
online_data = response.json()
except requests.exceptions.RequestException as e:
print(f"Error fetching data: {e}")
# Ensuring online_data is defined in case of an error
online_data = {}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
online_data = {}
If there is no online data, running the rest of the code is pointless.
But I agree some error handling would be nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I also mark this as viewed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure. I never marked any files as viewed. Let me know what it does to the file :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like this, viewed and approve
I was converting this into a draft. We need to fix the deployment (duplicate entries) before merging this |
If you want me to review it again, just send it to me :) |
Do I need to review it? Because all I got was a notification on the top right side, but no comment. |
I'm adding a Jupyter notebook and an "imported.yml" file. The notebook automatically imported all entries from our Zenodo community.
When the notebook is executed next time, it will not re-import entries. It will just add those which we were missing yet.
@SeverusYixin would you mind reviewing this PR? Let me know what you think!
This PR closes #47
Also related: #2