Protect what matters – even after you're gone. Make a plan for your digital legacy today.
Forum Discussion
jewettg
6 months 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..)
3 Replies
- jewettgNew Contributor
...
- 1P_Blake
Community Manager
Hey again jewettg! I know it’s been a while since you posted this, but I wanted to follow up here.
We’ve gone through and updated the Python SDK examples to include the required imports (like Website, AutofillBehavior, etc.), along with some other formatting improvements to make things a bit clearer. So you shouldn’t need to maintain your own internal versions for this going forward.
We’re also working toward more complete reference documentation so it’s clearer what types are available, when to use them, and how to import them without having to piece things together from different places.
Really appreciate you calling this out — it really helped us improve things here. 🙂