Getting started with 1Password for your growing team, or refining your setup? Our Secured Success quickstart guide is for you.
Forum Discussion
jewettg
11 days agoNew Contributor
Developer Doc "bugs"
As we are starting to develop utilizing 1Password SDK, I have been finding some "bugs" in the documentation. I would love to see these updated (to help other people). We have been having to create our own internal documentation.
From: https://developer.1password.com/docs/sdks/manage-items/#update-an-item
Update an item
To update an item, fetch the item you want to update, specify the changes you want to make, then pass the updated item to the client.Items.Put function.
# Update a field in your item
item.fields[0].value = "new_value"
item.websites.append(
Website(
label="my custom website 2",
url="https://example2.com",
autofill_behavior=AutofillBehavior.NEVER,
),
)
updated_item = await client.items.put(item)
Website is not a data type:
NameError: name 'Website' is not defined
From the page: https://developer.1password.com/docs/sdks/concepts/#field-types
There is no Data Type "Website", but there is a Data Type "Url", which I also tried, and it does not work either: NameError: name 'Url' is not defined
I finally, looking at the source code figured out that I had to do yet another "import":
from onepassword.types import ItemField, Website, AutofillBehavior
to make this work. Is there other documentation pages that go over all the other parts of "types.py" that tell us when they are used, where it is used, and how to do import for them?
Same goes for other code pages (secrets, items, errors, vaults, etc..)