pyzotero


Namepyzotero JSON
Version 1.7.3 PyPI version JSON
download
home_pageNone
SummaryPython wrapper for the Zotero API
upload_time2025-10-18 11:32:22
maintainerNone
docs_urlhttps://pythonhosted.org/pyzotero/
authorStephan Hügel
requires_python>=3.9
license# Blue Oak Model License Version 1.0.0 ## Purpose This license gives everyone as much permission to work with this software as possible, while protecting contributors from liability. ## Acceptance In order to receive this license, you must agree to its rules. The rules of this license are both obligations under that agreement and conditions to your license. You must not do anything with this software that triggers a rule that you cannot or will not follow. ## Copyright Each contributor licenses you to do everything with this software that would otherwise infringe that contributor's copyright in it. ## Notices You must ensure that everyone who gets a copy of any part of this software from you, with or without changes, also gets the text of this license or a link to <https://blueoakcouncil.org/license/1.0.0>. ## Excuse If anyone notifies you in writing that you have not complied with [Notices](#notices), you can keep your license by taking all practical steps to comply within 30 days after the notice. If you do not do so, your license ends immediately. ## Patent Each contributor licenses you to do everything with this software that would otherwise infringe any patent claims they can license or become able to license. ## Reliability No contributor can revoke this license. ## No Liability ***As far as the law allows, this software comes as is, without any warranty or condition, and no contributor will be liable to anyone for any damages related to this software or this license, under any kind of legal claim.***
keywords zotero dh
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            [![Supported Python versions](https://img.shields.io/pypi/pyversions/Pyzotero.svg?style=flat)](https://pypi.python.org/pypi/Pyzotero/) [![Docs](https://readthedocs.org/projects/pyzotero/badge/?version=latest)](http://pyzotero.readthedocs.org/en/latest/?badge=latest) [![PyPI Version](https://img.shields.io/pypi/v/Pyzotero.svg)](https://pypi.python.org/pypi/Pyzotero) [![Anaconda-Server Badge](https://anaconda.org/conda-forge/pyzotero/badges/version.svg)](https://anaconda.org/conda-forge/pyzotero) [![Downloads](https://pepy.tech/badge/pyzotero)](https://pepy.tech/project/pyzotero)  

# Pyzotero: An API Client for the Zotero API

# Quickstart

1. `uv add pyzotero` **or** `pip install pyzotero` **or** `conda install conda-forge::pyzotero`
2. You'll need the ID of the personal or group library you want to access:
    - Your **personal library ID** is available [here](https://www.zotero.org/settings/keys), in the section `Your userID for use in API calls`
    - For **group libraries**, the ID can be found by opening the group's page: `https://www.zotero.org/groups/groupname`, and hovering over the `group settings` link. The ID is the integer after `/groups/`
3. You'll also need<sup>†</sup> to get an **API key** [here][2]
4. Are you accessing your own Zotero library? `library_type` is `'user'`
5. Are you accessing a shared group library? `library_type` is `'group'`.  

Then:

``` python
from pyzotero import zotero
zot = zotero.Zotero(library_id, library_type, api_key) # local=True for read access to local Zotero
items = zot.top(limit=5)
# we've retrieved the latest five top-level items in our library
# we can print each item's item type and ID
for item in items:
    print(f"Item: {item['data']['itemType']} | Key: {item['data']['key']}")
```

# Documentation

Full documentation of available Pyzotero methods, code examples, and sample output is available on [Read The Docs][3].

# Command-Line Interface

Pyzotero includes an optional command-line interface for searching and querying your local Zotero library. The CLI must be installed separately (see [Installation](#optional-command-line-interface)).

## Basic Usage

The CLI connects to your local Zotero installation and allows you to search your library, list collections, and view item types:

```bash
# Search for top-level items
pyzotero search -q "machine learning"

# Search with full-text mode
pyzotero search -q "climate change" --fulltext

# Filter by item type
pyzotero search -q "methodology" --itemtype book --itemtype journalArticle

# Search for top-level items within a collection
pyzotero search --collection ABC123 -q "test"

# Output as JSON for machine processing
pyzotero search -q "climate" --json

# List all collections
pyzotero listcollections

# List available item types
pyzotero itemtypes
```

## Search Behaviour

By default, `pyzotero search` searches only top-level item titles and metadata fields.

When the `--fulltext` flag is used, the search expands to include all full-text indexed content, including PDFs and other attachments. Since most full-text content comes from PDF attachments rather than top-level items, the CLI automatically retrieves the parent bibliographic items for any matching attachments. This ensures you receive useful bibliographic records (journal articles, books, etc.) rather than raw attachment items.

## Output Format

By default, the CLI outputs human-readable text with a subset of metadata including:
- Title, authors, date, publication
- Volume, issue, DOI, URL
- PDF attachments (with local file paths)

Use the `--json` flag to output structured JSON.

# Installation

* Using [uv][11]: `uv add pyzotero`
* Using [pip][10]: `pip install pyzotero`
* Using Anaconda:`conda install conda-forge::pyzotero`

## Optional: Command-Line Interface

Pyzotero includes an optional command-line interface for searching and querying your local Zotero library. As it uses the local API server introduced in Zotero 7, it requires "Allow other applications on this computer to communicate with Zotero" to be enabled in Zotero's Settings > Advanced.

### Installing the CLI

To install Pyzotero with the CLI:

* Using [uv][11]: `uv add "pyzotero[cli]"`
* Using [pip][10]: `pip install "pyzotero[cli]"`

### Using the CLI without installing

If you just want to use the CLI without permanently installing Pyzotero, you can run it directly:

* Using [uvx][11]: `uvx --from "pyzotero[cli]" pyzotero search -q "your query"`
* Using [pipx][10]: `pipx run --spec "pyzotero[cli]" pyzotero search -q "your query"`

See the [Command-Line Interface](#command-line-interface) section below for usage details.

## Installing from Source

* From a local clone, if you wish to install Pyzotero from a specific branch: 

Example:

``` bash
git clone git://github.com/urschrei/pyzotero.git
cd pyzotero
git checkout main
# specify --dev if you're planning on running tests
uv sync
```

## Testing

Run `pytest .` from the top-level directory. This requires the `dev` dependency group to be installed: `uv sync --dev` / `pip install --group dev`

## Issues

The latest commits can be found on the [main branch][9], although new features are currently rare. If you encounter an error, please open an issue.

## Pull Requests

Pull requests are welcomed. Please read the [contribution guidelines](CONTRIBUTING.md). In particular, please **base your PR on the `main` branch**.

## Versioning

As of v1.0.0, Pyzotero is versioned according to [Semver](http://semver.org); version increments are performed as follows:  


1. MAJOR version will increment with incompatible API changes,
2. MINOR version will increment when functionality is added in a backwards-compatible manner, and
3. PATCH version will increment with backwards-compatible bug fixes.

# Citation

Pyzotero has a DOI:  
[![DOI](https://zenodo.org/badge/1423403.svg)](https://zenodo.org/badge/latestdoi/1423403)  
You may also cite Pyzotero using [CITATION.cff](CITATION.cff).  
A sample citation (APA 6th edition) might look like:  
> Stephan Hügel, The Pyzotero Authors (2019, May 18). urschrei/pyzotero: Version v1.3.15. http://doi.org/10.5281/zenodo.2917290

# License

Pyzotero is licensed under the [Blue Oak Model Licence 1.0.0][8]. See [LICENSE.md](LICENSE.md) for details.  

[1]: https://www.zotero.org/support/dev/web_api/v3/start
[2]: https://www.zotero.org/settings/keys/new
[3]: http://pyzotero.readthedocs.org/en/latest/
[7]: https://nose2.readthedocs.io/en/latest/
[8]: https://opensource.org/license/blue-oak-model-license
[9]: https://github.com/urschrei/pyzotero/tree/main
[10]: http://www.pip-installer.org/en/latest/index.html
[11]: https://docs.astral.sh/uv
† This isn't strictly true: you only need an API key for personal libraries and non-public group libraries.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pyzotero",
    "maintainer": null,
    "docs_url": "https://pythonhosted.org/pyzotero/",
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "Zotero, DH",
    "author": "Stephan H\u00fcgel",
    "author_email": "Stephan H\u00fcgel <urschrei@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/3c/2a/16aa2893cc1beb2a531c6fd32d679eac3017fc8fccd277fc5f3b0329c039/pyzotero-1.7.3.tar.gz",
    "platform": null,
    "description": "[![Supported Python versions](https://img.shields.io/pypi/pyversions/Pyzotero.svg?style=flat)](https://pypi.python.org/pypi/Pyzotero/) [![Docs](https://readthedocs.org/projects/pyzotero/badge/?version=latest)](http://pyzotero.readthedocs.org/en/latest/?badge=latest) [![PyPI Version](https://img.shields.io/pypi/v/Pyzotero.svg)](https://pypi.python.org/pypi/Pyzotero) [![Anaconda-Server Badge](https://anaconda.org/conda-forge/pyzotero/badges/version.svg)](https://anaconda.org/conda-forge/pyzotero) [![Downloads](https://pepy.tech/badge/pyzotero)](https://pepy.tech/project/pyzotero)  \n\n# Pyzotero: An API Client for the Zotero API\n\n# Quickstart\n\n1. `uv add pyzotero` **or** `pip install pyzotero` **or** `conda install conda-forge::pyzotero`\n2. You'll need the ID of the personal or group library you want to access:\n    - Your **personal library ID** is available [here](https://www.zotero.org/settings/keys), in the section `Your userID for use in API calls`\n    - For **group libraries**, the ID can be found by opening the group's page: `https://www.zotero.org/groups/groupname`, and hovering over the `group settings` link. The ID is the integer after `/groups/`\n3. You'll also need<sup>\u2020</sup> to get an **API key** [here][2]\n4. Are you accessing your own Zotero library? `library_type` is `'user'`\n5. Are you accessing a shared group library? `library_type` is `'group'`.  \n\nThen:\n\n``` python\nfrom pyzotero import zotero\nzot = zotero.Zotero(library_id, library_type, api_key) # local=True for read access to local Zotero\nitems = zot.top(limit=5)\n# we've retrieved the latest five top-level items in our library\n# we can print each item's item type and ID\nfor item in items:\n    print(f\"Item: {item['data']['itemType']} | Key: {item['data']['key']}\")\n```\n\n# Documentation\n\nFull documentation of available Pyzotero methods, code examples, and sample output is available on [Read The Docs][3].\n\n# Command-Line Interface\n\nPyzotero includes an optional command-line interface for searching and querying your local Zotero library. The CLI must be installed separately (see [Installation](#optional-command-line-interface)).\n\n## Basic Usage\n\nThe CLI connects to your local Zotero installation and allows you to search your library, list collections, and view item types:\n\n```bash\n# Search for top-level items\npyzotero search -q \"machine learning\"\n\n# Search with full-text mode\npyzotero search -q \"climate change\" --fulltext\n\n# Filter by item type\npyzotero search -q \"methodology\" --itemtype book --itemtype journalArticle\n\n# Search for top-level items within a collection\npyzotero search --collection ABC123 -q \"test\"\n\n# Output as JSON for machine processing\npyzotero search -q \"climate\" --json\n\n# List all collections\npyzotero listcollections\n\n# List available item types\npyzotero itemtypes\n```\n\n## Search Behaviour\n\nBy default, `pyzotero search` searches only top-level item titles and metadata fields.\n\nWhen the `--fulltext` flag is used, the search expands to include all full-text indexed content, including PDFs and other attachments. Since most full-text content comes from PDF attachments rather than top-level items, the CLI automatically retrieves the parent bibliographic items for any matching attachments. This ensures you receive useful bibliographic records (journal articles, books, etc.) rather than raw attachment items.\n\n## Output Format\n\nBy default, the CLI outputs human-readable text with a subset of metadata including:\n- Title, authors, date, publication\n- Volume, issue, DOI, URL\n- PDF attachments (with local file paths)\n\nUse the `--json` flag to output structured JSON.\n\n# Installation\n\n* Using [uv][11]: `uv add pyzotero`\n* Using [pip][10]: `pip install pyzotero`\n* Using Anaconda:`conda install conda-forge::pyzotero`\n\n## Optional: Command-Line Interface\n\nPyzotero includes an optional command-line interface for searching and querying your local Zotero library. As it uses the local API server introduced in Zotero 7, it requires \"Allow other applications on this computer to communicate with Zotero\" to be enabled in Zotero's Settings > Advanced.\n\n### Installing the CLI\n\nTo install Pyzotero with the CLI:\n\n* Using [uv][11]: `uv add \"pyzotero[cli]\"`\n* Using [pip][10]: `pip install \"pyzotero[cli]\"`\n\n### Using the CLI without installing\n\nIf you just want to use the CLI without permanently installing Pyzotero, you can run it directly:\n\n* Using [uvx][11]: `uvx --from \"pyzotero[cli]\" pyzotero search -q \"your query\"`\n* Using [pipx][10]: `pipx run --spec \"pyzotero[cli]\" pyzotero search -q \"your query\"`\n\nSee the [Command-Line Interface](#command-line-interface) section below for usage details.\n\n## Installing from Source\n\n* From a local clone, if you wish to install Pyzotero from a specific branch: \n\nExample:\n\n``` bash\ngit clone git://github.com/urschrei/pyzotero.git\ncd pyzotero\ngit checkout main\n# specify --dev if you're planning on running tests\nuv sync\n```\n\n## Testing\n\nRun `pytest .` from the top-level directory. This requires the `dev` dependency group to be installed: `uv sync --dev` / `pip install --group dev`\n\n## Issues\n\nThe latest commits can be found on the [main branch][9], although new features are currently rare. If you encounter an error, please open an issue.\n\n## Pull Requests\n\nPull requests are welcomed. Please read the [contribution guidelines](CONTRIBUTING.md). In particular, please **base your PR on the `main` branch**.\n\n## Versioning\n\nAs of v1.0.0, Pyzotero is versioned according to [Semver](http://semver.org); version increments are performed as follows:  \n\n\n1. MAJOR version will increment with incompatible API changes,\n2. MINOR version will increment when functionality is added in a backwards-compatible manner, and\n3. PATCH version will increment with backwards-compatible bug fixes.\n\n# Citation\n\nPyzotero has a DOI:  \n[![DOI](https://zenodo.org/badge/1423403.svg)](https://zenodo.org/badge/latestdoi/1423403)  \nYou may also cite Pyzotero using [CITATION.cff](CITATION.cff).  \nA sample citation (APA 6th edition) might look like:  \n> Stephan H\u00fcgel, The Pyzotero Authors (2019, May 18). urschrei/pyzotero: Version v1.3.15. http://doi.org/10.5281/zenodo.2917290\n\n# License\n\nPyzotero is licensed under the [Blue Oak Model Licence 1.0.0][8]. See [LICENSE.md](LICENSE.md) for details.  \n\n[1]: https://www.zotero.org/support/dev/web_api/v3/start\n[2]: https://www.zotero.org/settings/keys/new\n[3]: http://pyzotero.readthedocs.org/en/latest/\n[7]: https://nose2.readthedocs.io/en/latest/\n[8]: https://opensource.org/license/blue-oak-model-license\n[9]: https://github.com/urschrei/pyzotero/tree/main\n[10]: http://www.pip-installer.org/en/latest/index.html\n[11]: https://docs.astral.sh/uv\n\u2020 This isn't strictly true: you only need an API key for personal libraries and non-public group libraries.\n\n",
    "bugtrack_url": null,
    "license": "# Blue Oak Model License\n         \n         Version 1.0.0\n         \n         ## Purpose\n         \n         This license gives everyone as much permission to work with this software as possible, while protecting contributors from liability.\n         \n         ## Acceptance\n         \n         In order to receive this license, you must agree to its rules. The rules of this license are both obligations under that agreement and conditions to your license. You must not do anything with this software that triggers a rule that you cannot or will not follow.\n         \n         ## Copyright\n         \n         Each contributor licenses you to do everything with this software that would otherwise infringe that contributor's copyright in it.\n         \n         ## Notices\n         \n         You must ensure that everyone who gets a copy of any part of this software from you, with or without changes, also gets the text of this license or a link to <https://blueoakcouncil.org/license/1.0.0>.\n         \n         ## Excuse\n         \n         If anyone notifies you in writing that you have not complied with [Notices](#notices), you can keep your license by taking all practical steps to comply within 30 days after the notice. If you do not do so, your license ends immediately.\n         \n         ## Patent\n         \n         Each contributor licenses you to do everything with this software that would otherwise infringe any patent claims they can license or become able to license.\n         \n         ## Reliability\n         \n         No contributor can revoke this license.\n         \n         ## No Liability\n         \n         ***As far as the law allows, this software comes as is, without any warranty or condition, and no contributor will be liable to anyone for any damages related to this software or this license, under any kind of legal claim.***",
    "summary": "Python wrapper for the Zotero API",
    "version": "1.7.3",
    "project_urls": {
        "Repository": "https://github.com/urschrei/pyzotero",
        "Tracker": "https://github.com/urschrei/pyzotero/issues",
        "documentation": "https://pyzotero.readthedocs.org"
    },
    "split_keywords": [
        "zotero",
        " dh"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3ceb911c83692260288d822a550473ca368f4cec763e4bb5338d6c3c7f6f7038",
                "md5": "d10c8bf0fd5e3cae2fdb4f5089f1bbdb",
                "sha256": "14bf19714c06f6683ca163ea3c2391a0a160e7e4a138c0836246712c70c751e0"
            },
            "downloads": -1,
            "filename": "pyzotero-1.7.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d10c8bf0fd5e3cae2fdb4f5089f1bbdb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 29412,
            "upload_time": "2025-10-18T11:32:21",
            "upload_time_iso_8601": "2025-10-18T11:32:21.158015Z",
            "url": "https://files.pythonhosted.org/packages/3c/eb/911c83692260288d822a550473ca368f4cec763e4bb5338d6c3c7f6f7038/pyzotero-1.7.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "3c2a16aa2893cc1beb2a531c6fd32d679eac3017fc8fccd277fc5f3b0329c039",
                "md5": "a047bf28aa954ba70089cef8a7990884",
                "sha256": "02dea11893abafa93c6080a2a0a50f007958180a27492469e6537290921d8efc"
            },
            "downloads": -1,
            "filename": "pyzotero-1.7.3.tar.gz",
            "has_sig": false,
            "md5_digest": "a047bf28aa954ba70089cef8a7990884",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 532004,
            "upload_time": "2025-10-18T11:32:22",
            "upload_time_iso_8601": "2025-10-18T11:32:22.931079Z",
            "url": "https://files.pythonhosted.org/packages/3c/2a/16aa2893cc1beb2a531c6fd32d679eac3017fc8fccd277fc5f3b0329c039/pyzotero-1.7.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-18 11:32:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "urschrei",
    "github_project": "pyzotero",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "pyzotero"
}
        
Elapsed time: 0.47947s