urschrei / pyzotero

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

Support local API #191

Open vadim0x60 opened 6 days ago

vadim0x60 commented 6 days ago

Since Zotero 7, every installation of Zotero runs a local clone of the web API. In theory, a user that has Zotero installed could speed up pyzotero significantly with just one line of code:

zot = zotero.Zotero(library_id, library_type, api_key)
zot.endpoint = 'http://localhost:23119/api/'

Unfortunately, the way pyzotero builds URLs breaks this solution: for some reason the /api part of the endpoint gets dismissed and pyzotero tries calling http://localhost:23119/users/ instead of http://localhost:23119/api/users/.

With a little rework of the build_url function one could simplify the code as well as enable the ability to use local API.

urschrei commented 6 days ago

Sounds good, feel free to open a PR.