Skip to content

zenodo.get_user_records don't manage correctly 'not valid entries'

Bug description and behavior

zenodo.find_similar_records and .get_user_records don't manage correctly 'not valid entries' (entries that are not published or incomplete, although they appear when fetching them)

Steps to reproduce

recs = zen.get_user_records()
for r in recs:
...:     print(r.title)
...:
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-58-cfefe506c8f9> in <module>
      1 for r in recs:
----> 2     print(r.title)
      3
      4

~/ESCAPE/software/eossr/eossr/api/zenodo/__init__.py in title(self)
    574     @property
    575     def title(self):
--> 576         return self.data['metadata']['title']
    577
    578     @property

KeyError: 'title'



for r in recs:
...:     print(r.data['metadata'])
...:
{'prereserve_doi': {'doi': '10.5072/zenodo.938752', 'recid': 938752}}
{'prereserve_doi': {'doi': '10.5072/zenodo.928736', 'recid': 928736}}
{'prereserve_doi': {'doi': '10.5072/zenodo.926710', 'recid': 926710}}
{'prereserve_doi': {'doi': '10.5072/zenodo.926706', 'recid': 926706}}
{'prereserve_doi': {'doi': '10.5072/zenodo.926704', 'recid': 926704}}
{'prereserve_doi': {'doi': '10.5072/zenodo.926702', 'recid': 926702}}
{'prereserve_doi': {'doi': '10.5072/zenodo.926700', 'recid': 926700}}
{'prereserve_doi': {'doi': '10.5072/zenodo.926654', 'recid': 926654}}
{'prereserve_doi': {'doi': '10.5072/zenodo.926589', 'recid': 926589}}
{'prereserve_doi': {'doi': '10.5072/zenodo.926587', 'recid': 926587}}

Expected behavior?

Record could/should be able to exclude non complete entries (or just include them when fetching them if specified)

Relevant logs and/or screenshots

Possible fixes

Checking the Records structure before loading it.

(Please add other relevant labels if any)