urschrei / pyzotero

Pyzotero: a Python client for the Zotero API
https://pyzotero.readthedocs.org
Other
870 stars 96 forks source link

How to get notes associated with a journal entry? #138

Closed lpjiang97 closed 3 years ago

lpjiang97 commented 3 years ago

I'm trying to access the note entries that are associated with journal entries. But I'm having a hard time locating that. The dict returned by api.items() does not seem to contain note entries (tags do exist). I have tried the following code:

myapi.everything(myapi.items(itemType='Note'))

But this returns an empty list while I have multiple notes associated with journalArticle types. My private key has "Allow note access" turned on.

I'm on version 1.4.22, macOS Big Sur, and Python 3.8. Any help is appreciated!

urschrei commented 3 years ago

Note is an item type, and in your case it will be a child (or children) of a top-level journalArticle item. One way to do it would be to retrieve all top-level items first, and then call .children(itemType="Note") on each item that has a child count (and any other criteria you want to restrict by).

lpjiang97 commented 3 years ago

Gotcha, works now. Thanks!