Skip to content

Commit 4e944bd

Browse files
committed
add morgan change
1 parent 2e6941f commit 4e944bd

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

.github/workflows/wheels.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ jobs:
3939
CIBW_BEFORE_TEST: "pip install pydantic cryptography"
4040
CIBW_TEST_COMMAND: "python {project}/example/example.py"
4141
MACOSX_DEPLOYMENT_TARGET: 11.0 # Required for building on macOS
42-
CIBW_ENVIRONMENT_PASS_LINUX: OP_SERVICE_ACCOUNT_TOKEN # to pass in the SA token, for some reason linux doesn't read the env variables
4342
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.TEST_SERVICE_ACCOUNT_TOKEN }}
43+
OP_VAULT_ID: ${{ secrets.EXAMPLE_TESTS_OP_VAULT_ID }}
44+
CIBW_ENVIRONMENT_PASS_LINUX: OP_SERVICE_ACCOUNT_TOKEN, OP_VAULT_ID # to pass in the SA token, for some reason linux doesn't read the env variables
45+
46+
4447
continue-on-error: true
4548
uses: pypa/[email protected]
4649

example/example.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,16 @@ async def main():
4444
print(error)
4545
# [developer-docs.sdk.python.validate-secret-reference]-end
4646

47-
# [developer-docs.sdk.python.resolve-secret]-start
48-
# Retrieves a secret from 1Password. Takes a secret reference as input and returns the secret to which it points.
49-
value = await client.secrets.resolve("op://vault/item/field")
50-
print(value)
51-
# [developer-docs.sdk.python.resolve-secret]-end
47+
vault_id= os.getenv("OP_VAULT_ID")
48+
if vault_id is None:
49+
raise Exception("OP_VAULT_ID environment variable is not set")
5250

5351
# [developer-docs.sdk.python.create-item]-start
5452
# Create an Item and add it to your vault.
5553
to_create = ItemCreateParams(
5654
title="MyName",
5755
category=ItemCategory.LOGIN,
58-
vault_id="7turaasywpymt3jecxoxk5roli",
56+
vault_id=vault_id,
5957
fields=[
6058
ItemField(
6159
id="username",
@@ -95,6 +93,12 @@ async def main():
9593

9694
print(dict(created_item))
9795

96+
# [developer-docs.sdk.python.resolve-secret]-start
97+
# Retrieves a secret from 1Password. Takes a secret reference as input and returns the secret to which it points.
98+
value = await client.secrets.resolve(f"op://{created_item.vault_id}/{created_item.id}/username")
99+
print(value)
100+
# [developer-docs.sdk.python.resolve-secret]-end
101+
98102
# [developer-docs.sdk.python.resolve-totp-code]-start
99103
# Retrieves a secret from 1Password. Takes a secret reference as input and returns the secret to which it points.
100104
code = await client.secrets.resolve(
@@ -375,4 +379,4 @@ async def create_attach_and_delete_file_field_item(client: Client):
375379

376380

377381
if __name__ == "__main__":
378-
asyncio.run(main())
382+
asyncio.run(main())

0 commit comments

Comments
 (0)