{"library":"onepassword-sdk","title":"1Password Python SDK","description":"The 1Password Python SDK (version 0.4.0) offers programmatic read and write access to your secrets, vaults, and user/group permissions within 1Password. It supports authentication via the 1Password desktop app or 1Password Service Accounts, and is currently in its 0.x version series, indicating a rapid release cadence with ongoing feature additions.","language":"python","status":"active","last_verified":"Sat May 16","install":{"commands":["pip install onepassword-sdk"],"cli":null},"imports":["from onepassword.client import Client","from onepassword.client import Client, DesktopAuth"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import asyncio\nimport os\nfrom onepassword.client import Client\nfrom onepassword.models import FieldPurpose\n\nasync def main():\n    # Authenticate using a 1Password Service Account token from environment variable\n    token = os.environ.get(\"OP_SERVICE_ACCOUNT_TOKEN\")\n    if not token:\n        print(\"Error: OP_SERVICE_ACCOUNT_TOKEN environment variable not set.\")\n        return\n\n    # Connect to 1Password with your integration details\n    client = await Client.authenticate(\n        auth=token,\n        integration_name=\"My Test Integration\",\n        integration_version=\"v1.0.0\",\n    )\n\n    # Example: Retrieve a secret using a secret reference\n    # Replace 'op://vault/item/field' with your actual secret reference URI\n    try:\n        secret_value = await client.secrets.resolve(\"op://MyVault/MyLoginItem/password\")\n        print(f\"Retrieved secret: {secret_value}\")\n\n        # Example: List vaults (requires appropriate permissions)\n        vaults = await client.vaults.list()\n        print(f\"Found {len(vaults)} vaults:\")\n        for vault in vaults:\n            print(f\"- {vault.name} (ID: {vault.id})\")\n\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n    finally:\n        # Ensure the client connection is closed (if applicable, though often handled internally)\n        pass\n\nif __name__ == '__main__':\n    asyncio.run(main())\n","lang":"python","description":"This quickstart demonstrates how to authenticate with the 1Password SDK using a Service Account token provided via an environment variable (`OP_SERVICE_ACCOUNT_TOKEN`). It then shows how to resolve a secret using a 1Password secret reference and how to list available vaults. Remember to replace placeholder values like 'op://MyVault/MyLoginItem/password' and ensure your service account has the necessary permissions.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-16","installed_version":"0.4.0","pypi_latest":"0.4.0","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":3.5,"avg_import_s":0.74,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"onepassword-sdk","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.57,"mem_mb":12.5,"disk_size":"48.5M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"onepassword-sdk","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":4,"import_time_s":0.49,"mem_mb":12.5,"disk_size":"47M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"onepassword-sdk","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.86,"mem_mb":13.7,"disk_size":"51.7M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"onepassword-sdk","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":3.1,"import_time_s":0.82,"mem_mb":13.7,"disk_size":"49M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"onepassword-sdk","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":1.07,"mem_mb":13.6,"disk_size":"41.5M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"onepassword-sdk","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.6,"import_time_s":0.99,"mem_mb":13.6,"disk_size":"41M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"onepassword-sdk","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.57,"mem_mb":10.1,"disk_size":"41.2M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"onepassword-sdk","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.8,"import_time_s":0.57,"mem_mb":10.1,"disk_size":"41M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"onepassword-sdk","exit_code":0,"wheel_type":"sdist","failure_reason":null,"import_side_effects":"broken","install_time_s":null,"import_time_s":null,"mem_mb":null,"disk_size":"48.1M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"onepassword-sdk","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"broken","install_time_s":5.1,"import_time_s":null,"mem_mb":null,"disk_size":"46M"}]}}