A new Python tool kit for interacting with the locally hosted Zotero database.

edited February 15, 2021
Zotero provide pyzotero to use web api in python, but access locally hosted database or profile or files is not easy (and, qnotero is not easy to use and no longer maintained), that's the reason I develop the library pyzolocal, short for pyzotero-local.

Here lists the features:
- All api is well-designed with typehint and easy to use, you can read README to learn it quickly.
- There is no need to assign any path manually, pyzolocal can find it automatically.

> The storage path is saved in zotero profile, and the zotero profile dir is fixed and can be located easily, that's why it can locate path by itself. (However, I developed pyzolocal in my WinOS computer, so currently I can't promise pyzolocal can work well on Mac or Linux, you can report an issue for bugs.)

All api is well-designed and easy to use, you can read README to learn it quickly.

More features are in planning, like synchronize profile, locally database web api, etc.. WELCOME to contribute and issue.


Github Link:
- https://github.com/sailist/pyzotero-local

Description about profile directory
- https://www.zotero.org/support/kb/profile_directory
  • edited March 31, 2021
    I'm seeking an alternative to qnotero, similar to Qiqqa's InCite feature. How does pyzolocal relate to qnotero? Is this something that could be used to develop a new qnotero?

    I'm also confused as to why, even after getting qnotero working, it won't spit out a formatted reference. Like it can't give you something in APA or MLA format, only some info on separate lines, forcing you to go in and manually edit the reference. But it's quicker to just go to zotero and quick copy the formatted reference. I wonder if the ease of doing that is the reason qnotero isn't maintained.
  • @yanghaozhe

    I would like to try the python tool kit. I'm new to Python and I'm not clear about where to enter my directory path information.

    I'm looking at the GET PROFILE information, I followed the link to get the information, but I don't know where to enter that information within this code.
    Here's the Python code.
    ----------------
    1. from pprint import pprint
    2. from pyzolocal.prefs import prefjs_fn
    3. from pyzolocal.prefs.gets import (get_and_parse_user_prefs,
    search_user_prefs,
    get_and_parse_user_pref)
    4. from pyzolocal.prefs.common import dataDir

    5. pprint(dataDir())
    6. pprint(prefjs_fn())
    7. pprint(get_and_parse_user_prefs())

    # =============================
    8. \path\to\dataDir
    9. \path\to\prefs.js
    10. {'app.update.download.attempts': 0,
    'app.update.elevate.attempts': 0,
    'app.update.lastUpdateTime.addon-background-update-timer': 1613312615,
    ...}
    _______________
    Should I change code in line 5. and 6 like this?
    pprint(dataDir("C:\Users\MyName\Zotero"))
    pprint(prefjs_fn("C:\Users\MYNAMEi\AppData\Roaming\Zotero\Zotero\Profiles\MyRandomNumber")

    or do i just change lines 8 and 9?
    C:\Users\MyName\Zotero
    C:\Users\MYNAMEi\AppData\Roaming\Zotero\Zotero\Profiles\MyRandomNumber

    Could you share an example of what I should enter to get this to work?
    Thank you~
  • The tool should just find them. so you'd do this to set up the functions
    from pprint import pprint
    from pyzolocal.prefs import prefjs_fn
    from pyzolocal.prefs.gets import (get_and_parse_user_prefs,
    search_user_prefs,
    get_and_parse_user_pref)
    from pyzolocal.prefs.common import dataDir
    to set up the functions and then

    pprint(dataDir())
    would print your data repository path etc.
  • edited January 23, 2022
    This is marked as archived now. So it is outdated?

    How does it compare to this? https://gist.github.com/danbe/6547077 (some comments here: https://forums.zotero.org/discussion/81195/limited-proof-of-concept-csv-to-zotero-import)
Sign In or Register to comment.