From 5d56beab1436d631c459ce4d6509cf9f3418d454 Mon Sep 17 00:00:00 2001 From: Lucy Butcher Date: Wed, 10 Apr 2024 10:38:58 -0400 Subject: [PATCH 1/6] Rename to "examples" to match JS --- {example => examples}/example.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {example => examples}/example.py (100%) diff --git a/example/example.py b/examples/example.py similarity index 100% rename from example/example.py rename to examples/example.py From 957284e67490307bb388d602cd0e861d8ad8b49e Mon Sep 17 00:00:00 2001 From: Lucy Butcher Date: Wed, 10 Apr 2024 10:40:05 -0400 Subject: [PATCH 2/6] Add README --- examples/README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 examples/README.md diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 00000000..99052b7a --- /dev/null +++ b/examples/README.md @@ -0,0 +1,12 @@ +# Examples + +This folder contains code snippets that demonstrate how to import and use the 1Password Python SDK. + +## Prerequisites + +1. Clone the repository. +2. Make sure to export a valid service account token. For example: + ```bash + export OP_SERVICE_ACCOUNT_TOKEN="" + ``` + Learn more about [service accounts](https://developer.1password.com/docs/service-accounts/get-started). From e5040cea94ed102184f4cf438a0d6e402dd40844 Mon Sep 17 00:00:00 2001 From: Lucy Butcher Date: Wed, 10 Apr 2024 10:41:20 -0400 Subject: [PATCH 3/6] Code comment edits --- examples/example.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/example.py b/examples/example.py index 6be65087..7a0a7a14 100644 --- a/examples/example.py +++ b/examples/example.py @@ -6,10 +6,11 @@ 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. + # Authenticates with your token and connects to 1Password. 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. + # 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") print(value) From 38e944a2ca5cc9ac2eeecb8cebe04c2e427dbf49 Mon Sep 17 00:00:00 2001 From: Lucy Butcher Date: Wed, 10 Apr 2024 10:50:42 -0400 Subject: [PATCH 4/6] README edits --- examples/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/examples/README.md b/examples/README.md index 99052b7a..bd8e45d2 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,12 +1,11 @@ # Examples -This folder contains code snippets that demonstrate how to import and use the 1Password Python SDK. +This folder contains a code snippet that demonstrates how to use the 1Password Python SDK to retrieve a secret from 1Password. ## Prerequisites -1. Clone the repository. +1. Clone the repository and follow the steps to [get started](https://github.com/1Password/onepassword-sdk-python?tab=readme-ov-file#get-started). 2. Make sure to export a valid service account token. For example: ```bash export OP_SERVICE_ACCOUNT_TOKEN="" ``` - Learn more about [service accounts](https://developer.1password.com/docs/service-accounts/get-started). From 3ba6753759a2d1aabdabc15b8066330022b31b94 Mon Sep 17 00:00:00 2001 From: Lucy Butcher Date: Wed, 10 Apr 2024 11:01:17 -0400 Subject: [PATCH 5/6] Revert folder name change --- {examples => example}/README.md | 0 {examples => example}/example.py | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename {examples => example}/README.md (100%) rename {examples => example}/example.py (100%) diff --git a/examples/README.md b/example/README.md similarity index 100% rename from examples/README.md rename to example/README.md diff --git a/examples/example.py b/example/example.py similarity index 100% rename from examples/example.py rename to example/example.py From 5c9024d2c5436f746dde17728e32e82e64ba07b4 Mon Sep 17 00:00:00 2001 From: Lucy Butcher <89952129+libutcher@users.noreply.github.com> Date: Wed, 10 Apr 2024 11:02:46 -0400 Subject: [PATCH 6/6] Fix spacing --- example/example.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/example.py b/example/example.py index 7a0a7a14..8c35df33 100644 --- a/example/example.py +++ b/example/example.py @@ -10,7 +10,7 @@ async def main(): 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. + # Takes a secret reference as input and returns the secret to which it points. value = await client.secrets.resolve("op://vault/item/field") print(value)