You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before calling this method, the use of check_items() is encouraged, in order to confirm that the item to be created contains only valid fields.
and then an example is provided
template=zot.item_template('book')
template['creators'][0]['firstName'] ='Monty'template['creators'][0]['lastName'] ='Cantsin'template['title'] ='Maris Kundzins: A Life'resp=zot.create_items([template])
If we modify this example to follow the recommendation of using check_items() as follow
template=zot.item_template('book')
template['creators'][0]['firstName'] ='Monty'template['creators'][0]['lastName'] ='Cantsin'template['title'] ='Maris Kundzins: A Life'zot.check_items([template])
resp=zot.create_items([template])
it crashes with
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/oreilly/.local/lib/python3.4/site-packages/pyzotero/zotero.py", line 806, in check_items
to_check = set(i for i in list(item['data'].keys()))
KeyError: 'data'
It is not obvious how to use check_items() in conjunction with item_template() since these templates miss a bunch of fields that seems to be expected (fields that are there when used it in conjunction with items() for example).
The text was updated successfully, but these errors were encountered:
With regard to the additional top-level fields (u'links', u'library', u'version', u'meta', u'key') you see when you retrieve an item using e.g. items(), that's additional metadata that isn't required in order to create items, and Pyzotero checks for these keys and removes them prior to uploading, so you can round-trip retrieved items that you've modified.
In the doc, it is said :
and then an example is provided
If we modify this example to follow the recommendation of using check_items() as follow
it crashes with
It is not obvious how to use check_items() in conjunction with item_template() since these templates miss a bunch of fields that seems to be expected (fields that are there when used it in conjunction with items() for example).
The text was updated successfully, but these errors were encountered: