> For the complete documentation index, see [llms.txt](https://manual.dxable.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://manual.dxable.com/1password/1password-python-sdk.md).

# 1Password Python SDK

**1Password Python SDK**

**1Password の秘密にプログラムでアクセスする統合を構築します。**

[ドキュメント](https://developer.1password.com/docs/sdks/)|[例](https://github.com/1Password/onepassword-sdk-python/tree/main/example)

必要条件

1Password Python SDK は次のものと互換性があります:

* python3.9以降
* libssl3
* glibc2.32以降

libsslDebian 11 や Ubuntu 20.04 など、バージョン 1.1.1 をまだ使用している Linux ディストリビューションを実行している場合は、 Linux の新しいバージョンに更新するか、必要な依［Save］関係をインストールする必要があります。

🚀 **始める**

プロジェクトで 1Password Python SDK を使うには:

1. [サービス アカウントをCreateし](https://my.1password.com/developer-tools/infrastructure-secrets/serviceaccount/)、SDK で使うアイテムがSaveされている保管庫に適切な権限を付与します。
2. サービス アカウント トークンをプロビジョニングします。環境からトークンをプロビジョニングすることをお勧めします。例えば、トークンをOP\_SERVICE\_ACCOUNT\_TOKEN環境変数にエクスポートするには、次のようにします。\
   **macOS または Linux**\
   export OP\_SERVICE\_ACCOUNT\_TOKEN=\<your-service-account-token>

   **ウィンドウズ**\
   $Env:OP\_SERVICE\_ACCOUNT\_TOKEN = "\<your-service-account-token>"
3. プロジェクトに 1Password Python SDK をインストールします。\
   pip install onepassword-sdk
4. プロジェクトで Python SDK を使用します。

import asyncio

import os

from onepassword.client import Client

async def main():

\# Gets your service account token from the OP\_SERVICE\_ACCOUNT\_TOKEN environment variable.

token = os.getenv("OP\_SERVICE\_ACCOUNT\_TOKEN")

\# Connects to 1Password. Fill in your own integration name and version.

client = await Client.authenticate(auth=token, integration\_name="My 1Password Integration", integration\_version="v1.0.0")

\# Retrieves a secret from 1Password. Takes a secret reference as input and returns the secret to which it points.

value = await client.secrets.resolve("op\://vault/item/field")

\# use value here

if \_\_name\_\_ == '\_\_main\_\_':

asyncio.run(main())

1Password からコードにシークレットを安全に読み込むには、構文で[シークレット参照 URI を使う](https://developer.1password.com/docs/cli/secret-reference-syntax/)ようにしてください。op\://vault/item/field

**サポートされている機能**

1Password SDK は現在開発中です。次に何を希望するか、ぜひご意見をお聞かせください。[賛Create票を投じる](https://github.com/1Password/onepassword-sdk-python/issues)か、問題を[報告してお知らせください。](https://github.com/1Password/onepassword-sdk-python/issues/new/choose)

**アイテム管理**

操Create:

* [秘密を取得する](https://developer.1password.com/docs/sdks/load-secrets)
* [アイテムを取得する](https://developer.1password.com/docs/sdks/manage-items#get-an-item)
* [アイテムをCreateする](https://developer.1password.com/docs/sdks/manage-items#create-an-item)
* [アイテムを更新する](https://developer.1password.com/docs/sdks/manage-items#update-an-item)
* [アイテムを削除する](https://developer.1password.com/docs/sdks/manage-items#delete-an-item)
* [リスト項目](https://developer.1password.com/docs/sdks/list-vaults-items/)
* アイテムのタグを追加および更新する

フィールドタイプ:

* APIキー
* パスワード
* 隠されたフィールド
* テキストフィールド
* 注記
* SSH 秘密鍵 (部分的にサポート: シークレット参照の解決ではサポートされていますが、アイテムのCreate/取得/更新ではまだサポートされていません)
* SSH公開鍵、指紋、鍵の種類
* ワンタイムパスワード
* URL
* ウェブサイト（ログインの提案や自動入力に使用）
* 電話番号
* クレジットカードの種類
* ファイルの添付とドキュメント項目

**金庫管理**

* 金庫を回収する
* 金庫をCreateする ( [#36](https://github.com/1Password/onepassword-sdk-python/issues/36) )
* 金庫を更新する
* 金庫を削除する
* 保管庫[の一覧](https://developer.1password.com/docs/sdks/list-vaults-items/)

**ユーザーとアクセス管理**

* ユーザーのプロビジョニング
* ユーザーを取得する
* ユーザーを一覧表示する
* ユーザーを停止する
* グループをCreateする
* グループメンバーシップを更新する
* 保管庫のアクセスと権限を更新する

**コンプライアンスと報告**

* ものみの塔の洞察
* 旅行モード
* イベント。今のところ、[1Password イベント レポート API を](https://developer.1password.com/docs/events-api/)直接使用してください。

**認証**

* [1Password サービスアカウント](https://developer.1password.com/docs/service-accounts/get-started/)
* ユーザー認証
* 1Password Connect。今のところ、[1Password/connect-sdk-python](https://github.com/1Password/connect-sdk-python)を使用してください。

📖 **詳細はこちら**

* [1Password SDKでシークレットをロードする](https://developer.1password.com/docs/sdks/load-secrets)
* [1Password SDKでアイテムを管理する](https://developer.1password.com/docs/sdks/manage-items)
* [1Password SDKを使用して保管庫とアイテムを一覧表示する](https://developer.1password.com/docs/sdks/list-vaults-items)
* [1Password SDKのコンセプト](https://developer.1password.com/docs/sdks/concepts)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://manual.dxable.com/1password/1password-python-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
