{"library":"pyzotero","title":"pyzotero","description":"Python wrapper for the Zotero API, enabling programmatic access to Zotero libraries for managing research references, collections, and items. It's currently at version 1.11.0 and typically releases new versions every few months, often including bug fixes and minor enhancements.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install pyzotero"],"cli":null},"imports":["from pyzotero import Zotero"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nfrom pyzotero import Zotero\n\n# Your Zotero user ID or group ID\nlibrary_id = os.environ.get('ZOTERO_LIBRARY_ID', 'YOUR_LIBRARY_ID') # Replace 'YOUR_LIBRARY_ID' if not using env var\n# Your Zotero API key\napi_key = os.environ.get('ZOTERO_API_KEY', 'YOUR_API_KEY') # Replace 'YOUR_API_KEY' if not using env var\n\n# 'user' for personal library, 'group' for group library\nlibrary_type = 'user'\n\nif not library_id or not api_key:\n    print(\"Please set ZOTERO_LIBRARY_ID and ZOTERO_API_KEY environment variables or replace placeholders.\")\nelse:\n    try:\n        # Initialize Zotero object\n        zot = Zotero(library_id, library_type, api_key)\n\n        # Fetch top-level collections\n        collections = zot.collections()\n        print(f\"Found {len(collections)} collections.\")\n        if collections:\n            print(f\"First collection name: {collections[0]['data']['name']}\")\n\n        # Fetch 5 items from the library\n        items = zot.items(limit=5)\n        print(f\"Found {len(items)} items.\")\n        if items:\n            print(f\"First item title: {items[0]['data']['title']}\")\n\n    except Exception as e:\n        print(f\"An error occurred: {e}\")","lang":"python","description":"This quickstart initializes the Zotero client and fetches the first few collections and items from your library. It demonstrates accessing nested data fields and uses environment variables for secure credential management.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}