Skip to main content

Python SDK for Zotero debug-bridge

Project description

zotero-bridge

PyPI Python CI License

Python SDK for the Zotero debug-bridge — programmatically manage your Zotero library via HTTP.

Install

pip install zotero-bridge

Or from source:

git clone https://github.com/Xp-speit2018/zotero-bridge.git
cd zotero-bridge
pip install -e ".[dev]"

Quick start

from zotero_bridge import ZoteroBridge

bridge = ZoteroBridge()

# Duplicate check
dup = bridge.check_duplicate("10.1145/3597926.3598095", "DOI")

# Add by identifier (magic wand)
item = bridge.add_by_identifier("10.1145/3597926.3598095", "DOI")

# Auto-fetch PDF
bridge.find_fulltext(item["itemID"])

# Add note + tag
bridge.add_note(item["itemID"], "Key insight: ...")
bridge.add_tag(item["itemID"], "to-read")

# Download PDF bytes
pdf = bridge.get_pdf_bytes(item["itemID"])

Configuration

Environment variables (optional):

Variable Default Description
ZOTERO_BRIDGE_URL http://localhost:23120 Debug-bridge proxy URL
ZOTERO_BRIDGE_TOKEN zotero-debug Bearer token
ZOTERO_LIBRARY_ID (empty) Library ID; empty = user library

Or a .env file (requires python-dotenv):

ZOTERO_BRIDGE_URL=http://localhost:23120
ZOTERO_BRIDGE_TOKEN=zotero-debug

CLI ingestion workflow

A ready-made pipeline that checks for duplicates, fetches metadata + PDF, creates DBLP-style venue collections, and aliases items into a project collection:

# Auto-derive venue from metadata
zotero-ingest --doi "10.1145/3597926.3598095" --project "MyResearch"

# Or specify venue explicitly (still normalised to DBLP convention)
zotero-ingest --doi "10.1145/3597926.3598095" --venue "ASPLOS" --project "MyResearch"

Note that metadata and pdf collection uses the built-in magic wand and Find Full Text functionality, which maybe paywalled or not depending on your network.

API overview

Items

Method Description
check_duplicate(identifier, id_type) Query by DOI / ISBN / arXiv / title
add_by_identifier(identifier, id_type) Magic wand ingest
find_fulltext(item_id) Auto-download PDF
get_item(item_id) Retrieve metadata
delete_item(item_id) Trash an item
update_field(item_id, field, value) Update a single field
add_tag(item_id, tag) Add a tag
remove_tag(item_id, tag) Remove a tag

Notes

Method Description
add_note(item_id, note_text) Add a child note
get_notes(item_id) List child notes

Attachments

Method Description
get_attachments(item_id) List all attachments with paths
retrieve_pdf(item_id) Get PDF metadata
get_pdf_bytes(item_id) Download raw PDF bytes

Collections

Method Description
create_collection(name, parent_id) Create a collection
get_collections(parent_id) List collections
get_or_create_collection(name, parent_id) Idempotent creation
add_to_collection(item_id, collection_id) Alias / place item
remove_from_collection(item_id, collection_id) Remove from collection

Export

Method Description
export.item(item_id, format, options) Export a single item
export.items(item_ids, format, options) Export multiple items
export.collection(collection_id, format, options) Export a whole collection
export.library(format, options) Export the entire library
export.list_formats() List available export formats

Supported formats: better-bibtex, better-biblatex, bibtex, biblatex, ris, csl-json, csv, zotero-rdf, tei, cff.

# Better BibTeX with notes
bib = bridge.export.item(item_id, format="better-bibtex", options={"exportNotes": True})

# Full collection as RIS
ris = bridge.export.collection(collection_id, format="ris")

# Entire library
bib = bridge.export.library(format="better-bibtex")

DBLP venue naming

When the ingestion workflow auto-derives a venue name, it normalises to DBLP convention:

  • ISSTA 2023issta2023
  • ASPLOS 2025, Volume 1asplos2025-1
  • NeurIPS 2023, Volume 2neurips2023-2

A curated mapping of 50+ common venues + DBLP API fallback + local cache handles less common venues automatically.

Requirements

Releases

Version Date PyPI Notes
0.2.0 2025-05-18 zotero-bridge-0.2.0 Export support (BibTeX, RIS, CSL JSON, etc.)
0.1.0 2025-05-18 zotero-bridge-0.1.0 Initial release

Publishing is automated via GitHub Actions and PyPI Trusted Publishing. To release a new version:

  1. Bump version in pyproject.toml and zotero_bridge/__init__.py
  2. Commit and push
  3. Create a GitHub Release with a new tag (e.g. v0.2.0)
  4. The workflow builds and uploads to PyPI automatically

Acknowledgements

This SDK is built on top of the Zotero debug-bridge extension by Emile Sonneveld / iris-advies.com, originally distributed as part of the zotero-better-bibtex test fixtures. The debug-bridge enables arbitrary JavaScript execution inside a running Zotero instance via an authenticated HTTP endpoint, which is the foundation of everything this SDK does.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zotero_bridge-0.2.0.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zotero_bridge-0.2.0-py3-none-any.whl (17.1 kB view details)

Uploaded Python 3

File details

Details for the file zotero_bridge-0.2.0.tar.gz.

File metadata

  • Download URL: zotero_bridge-0.2.0.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zotero_bridge-0.2.0.tar.gz
Algorithm Hash digest
SHA256 db16d16c48e5bea5cc56ae0410ef59603ae2e55c4bd7fa60dde3e321662c51eb
MD5 2f1456ec0bc2ba44a6f73b848217e521
BLAKE2b-256 eb79f7e3bcc2297adda56aecafe98b582debbdc30cc15e41da35502e711faea2

See more details on using hashes here.

Provenance

The following attestation bundles were made for zotero_bridge-0.2.0.tar.gz:

Publisher: publish.yml on Xp-speit2018/zotero-bridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file zotero_bridge-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: zotero_bridge-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for zotero_bridge-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cde788385995697889f704423f1e630bce7af72f39c2a7098db1c450c2f349a1
MD5 be46baf7e2abfd6887ad4c426c673078
BLAKE2b-256 959825e9f85fe860a586db5107cfc5ea777e0cb87b38531efd1b214167261335

See more details on using hashes here.

Provenance

The following attestation bundles were made for zotero_bridge-0.2.0-py3-none-any.whl:

Publisher: publish.yml on Xp-speit2018/zotero-bridge

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page