Skip to content

Commit 3328f8b

Browse files
committed
Add release notes and example
1 parent 6f9a714 commit 3328f8b

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

example/example.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async def main():
3535
# [developer-docs.sdk.python.validate-secret-reference]-start
3636
# Validate secret reference to ensure no syntax errors
3737
try:
38-
await Secrets.validate_secret_reference("op//vault/item/field")
38+
await Secrets.validate_secret_reference("op://vault/item/field")
3939
except Exception as error:
4040
print(error)
4141
# [developer-docs.sdk.python.validate-secret-reference]-end
@@ -51,7 +51,7 @@ async def main():
5151
to_create = ItemCreateParams(
5252
title="MyName",
5353
category="Login",
54-
vault_id="q73bqltug6xoegr3wkk2zkenoq",
54+
vault_id="7turaasywpymt3jecxoxk5roli",
5555
fields=[
5656
ItemField(
5757
id="username",
@@ -84,6 +84,12 @@ async def main():
8484

8585
print(dict(created_item))
8686

87+
# [developer-docs.sdk.python.resolve-totp-code]-start
88+
# Retrieves a secret from 1Password. Takes a secret reference as input and returns the secret to which it points.
89+
code = await client.secrets.resolve(f"op://{created_item.vault_id}/{created_item.id}/TOTP_onetimepassword?attribute=totp")
90+
print(code)
91+
# [developer-docs.sdk.python.resolve-totp-code]-end
92+
8793
# [developer-docs.sdk.python.get-totp-item-crud]-start
8894
# Fetch a totp code from the item
8995
for f in created_item.fields:

src/release/RELEASE-NOTES

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
This is the v0.1.2 release of the 1Password Python SDK.
2-
3-
This release includes:
4-
* introduces support for tags, users can now create, update, and delete tags on 1Password Items.
5-
* introduces a `Validate Secret Reference` function that will ensure the syntax of your secret reference is error free.
6-
* Fields and Sections are now optional in `ItemCreateParams` and the user won't have to specify them if not needed anymore.
7-
* The Python SDK will now be released on PyPi and users can now fetch the 1Password Python SDK by doing the following:
8-
```
9-
pip3 install onepassword-sdk
10-
```
1+
The v0.1.2 release of the Python SDK brings:
2+
* Support for item tags. You can now create, get, and edit tags within your 1Password items using item CRUD functions.
3+
* Support for fetching one-time password codes using secret references. You can now fetch your TOTP code with the `secrets.resolve` function, using a secret reference for the TOTP field in your item. For example: "op://vault/item/field?=attribute=totp"
4+
* Support for validating secret references. You can now check that a secret reference is formatted correctly without having to resolve it or even authenticate, using the `validate_secret_reference` function.
5+
* PyPI wheels for the Python SDK. You can now install the Python SDK via `pip3 install onepassword-sdk`
6+
* Full support for optional values. You no longer have to manually set `details: None` or `section: None` when instantiating `ItemCreateParams`.
7+
* Item creation now only requires specifying the vault ID, item category, and item title.

0 commit comments

Comments
 (0)