Skip to content

add get note example #217

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions example/local_get_notes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from pyzotero import zotero

def get_item_notes(zot, item_id):
"""Get notes for a specific item

Args:
zot: Zotero instance
item_id: ID of the Zotero item

Returns:
List of notes (as dicts) for the item

"""
children = zot.children(item_id)
notes = [child for child in children if child['data']['itemType'] == 'note']
return notes

# Example usage
if __name__ == "__main__":
# Initialize Zotero
zot = zotero.Zotero(library_id='000000', library_type='user', local=True)

# Get notes by item id, this item must have notes
item_id = 'H62SJYVX'
notes = get_item_notes(zot, item_id)
print(notes)

Loading