Skip to content

Commit f87496d

Browse files
committed
add dev docs tags for examples and update release notes
1 parent 9d36ced commit f87496d

File tree

2 files changed

+27
-41
lines changed

2 files changed

+27
-41
lines changed

example/example.py

Lines changed: 13 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ async def main():
3131
# [developer-docs.sdk.python.list-vaults]-end
3232

3333
# [developer-docs.sdk.python.list-items]-start
34-
items = await client.items.list_all(vault.id)
35-
async for item in items:
36-
print(item.title)
34+
# items = await client.items.list_all(vault.id)
35+
# async for item in items:
36+
# print(item.title)
3737
# [developer-docs.sdk.python.list-items]-end
3838

3939
# [developer-docs.sdk.python.validate-secret-reference]-start
@@ -229,6 +229,7 @@ async def share_item(client: Client, vault_id: str, item_id: str):
229229

230230

231231
async def create_ssh_key_item(client: Client):
232+
# [developer-docs.sdk.python.create-sshkey-item]-start
232233
# Generate a 2048-bit RSA private key
233234
private_key = rsa.generate_private_key(
234235
public_exponent=65537,
@@ -242,7 +243,6 @@ async def create_ssh_key_item(client: Client):
242243
encryption_algorithm=serialization.NoEncryption(),
243244
)
244245

245-
# [developer-docs.sdk.python.create-sshkey-item]-start
246246
# Create an Item containing SSH Key and add it to your vault.
247247
to_create = ItemCreateParams(
248248
title="SSH Key Item Created With Python SDK",
@@ -398,18 +398,8 @@ async def resolve_all_secrets(client: Client, vault_id: str, item_id: str, field
398398

399399
def generate_special_item_fields():
400400

401-
# Generate an Ed25519 private key
402-
private_key = ed25519.Ed25519PrivateKey.generate()
403-
404-
# Encode the private key into a PEM encoded string. This will be assigned to the item field
405-
private_pem = private_key.private_bytes(
406-
encoding=serialization.Encoding.PEM,
407-
format=serialization.PrivateFormat.PKCS8,
408-
encryption_algorithm=serialization.NoEncryption()
409-
)
410-
411401
fields=[
412-
# Address
402+
# [developer-docs.sdk.python.address-field-type]-start
413403
ItemField(
414404
id="address",
415405
title="Address",
@@ -418,22 +408,25 @@ def generate_special_item_fields():
418408
details=ItemFieldDetailsAddress(type="Address", content=AddressFieldDetails(street="1234 Main St", city="San Francisco", state="CA", zip="94111", country="USA")),
419409
sectionId="",
420410
),
421-
# Date
411+
# [developer-docs.sdk.python.address-field-type]-end
412+
# [developer-docs.sdk.python.date-field-type]-start
422413
ItemField(
423414
id="date",
424415
title="Date",
425416
field_type=ItemFieldType.DATE,
426417
section_id="mysection",
427418
value="1998-03-15",
428419
),
429-
# MonthYear
420+
# [developer-docs.sdk.python.date-field-type]-end
421+
# [developer-docs.sdk.python.month-year-field-type]-start
430422
ItemField(
431423
id="month_year",
432424
title="Month Year",
433425
field_type=ItemFieldType.MONTHYEAR,
434426
section_id="mysection",
435427
value="03/1998",
436428
),
429+
# [developer-docs.sdk.python.month-year-field-type]-end
437430
# Reference
438431
ItemField(
439432
id="Reference",
@@ -442,28 +435,14 @@ def generate_special_item_fields():
442435
value="f43hnkatjllm5fsfsmgaqdhv7a",
443436
sectionId="references"
444437
),
445-
# TOTP from URL
438+
# [developer-docs.sdk.python.reference-field-type]-end
439+
# [developer-docs.sdk.python.totp-field-type]-start
446440
ItemField(
447441
id="onetimepassword",
448442
title="one-time-password",
449443
field_type=ItemFieldType.TOTP,
450444
section_id="totpsection",
451445
value="otpauth://totp/my-example-otp?secret=jncrjgbdjnrncbjsr&issuer=1Password",
452446
),
453-
# TOTP from Secret
454-
ItemField(
455-
id="onetimepassword",
456-
title="one-time-password",
457-
field_type=ItemFieldType.TOTP,
458-
section_id="totpsection",
459-
value="jncrjgbdjnrncbjsr",
460-
),
461-
# SSH key
462-
ItemField(
463-
id="private_key",
464-
title="private key",
465-
field_type=ItemFieldType.SSHKEY,
466-
value=private_pem,
467-
sectionId="",
468-
),
447+
# [developer-docs.sdk.python.totp-field-type]-end
469448
],

src/release/RELEASE-NOTES

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
# 1Password Python SDK v0.2.0
1+
# 1Password Python SDK v0.2.1
22

33
## NEW
44

5-
- **File Support:** You can now create Document items, attach files to items, delete files from items, and read file contents using the SDK.
5+
- **`CreatedAt` and `UpdatedAt` item metadata:** Items and item overviews now expose attributes with their creation and last edit times.
6+
- **Resolving secrets in bulk**: With the `client.secrets.resolveAll` function, the SDK is now able to resolve multiple secrets at once, improving the performance of the operation.
67

78
## IMPROVED
89

9-
- **Read files using secret references**: You can now resolve secret references that point to files attached to 1Password items.
10-
- **Read SSH keys in Open SSH format**: You can now use a secret reference to fetch a private key in OpenSSH format. For example: `op://vault/<SSH item>/private key?ssh-format=openssh`
11-
- **Support for more item field types**: You can now create, retrieve, and edit items containing SSH keys, Month-Year and Menu-type fields using the SDK.
12-
- **Read more field types using secret references**: You can now resolve secret references that point to information stored in Date, Month/Year, Address, and Reference field types.
13-
- **Improved error messages**: The error messages returned by the SDK were improved to be more clear and actionable.
10+
- **Support for new field types:** Items with `Address` and `Date` fields can now be created, retrieved, and edited using the 1Password SDK.
11+
- **Item sharing for attachments and documents**: Items with files attached now can also be shared using the `client.items.shares` functions.
12+
- **Adding custom fields in sections automatically**: The SDK now automatically adds custom fields without a section to an empty section within the item, creating it if necessary.
13+
- **`Tags` in item overviews**: The return type of `items.listAll` now also contains the item tags.
14+
- **Broader item editing capabilities**: You are now able to use the `items.put` function on more items, including those with fields that are not directly editable through the SDK (such as legacy fields, passkeys etc.)
15+
16+
## FIXED
17+
18+
- **Improvements to resolving secret references:**
19+
- Archived items are no longer used for secret references.
20+
- When multiple sections match a section query in resolving secret references, the SDK look through the fields in all sections, instead of erroring.

0 commit comments

Comments
 (0)