Closed gregorias closed 1 month ago
Hey @gregorias ! Thanks for reaching out about this bug. The functionality you're using should be supported and this is indeed a bug.
We will look into it!
Hey @gregorias, could you share more about the project setup in which this error occurs? We're attempting to reproduce this issue and we were wondering whether:
poetry
.poetry
is pulling for you?python3 your_main.py
or poetry shell && python3 your_main.py
or poetry run python your_main.py
or are you running the SDK in a test file? If you're running the SDK in tests, what testing framework are you using?So while working the questions, I made the issue disappear by specifying v0.1.1
specifically in the manifest file:
onepassword = { git = "https://github.com/1Password/onepassword-sdk-python.git", tag = 'v0.1.1' }
It was like this before:
onepassword = { git = "https://github.com/1Password/onepassword-sdk-python.git" }
and it was installing https://github.com/1Password/onepassword-sdk-python/commit/d9e45c99ba4475dcba6369c412f5d705a17bfc43. https://github.com/1Password/onepassword-sdk-python/commit/713e09f287bdb0661514aab82e5673839dfeb845, on the other hand, works fine.
I bisected the commits and https://github.com/1Password/onepassword-sdk-python/commit/d9e45c99ba4475dcba6369c412f5d705a17bfc43 is the bad commit that breaks my use-case.
Here’s a script that I am using to reproduce this issue:
# repro.py
from onepassword.client import Client # type: ignore
async def get_vault_id(client, vault_name: str) -> str | None:
async for vault in await client.vaults.list_all():
if vault.title == vault_name:
return vault.id
return None
async def get_item_id(client, vault_id, item_name: str) -> str | None:
async for item in await client.items.list_all(vault_id):
if item.title == item_name:
return item.id
return None
async def main():
client = await Client.authenticate(
auth=
'redacted_for_obvious_reasons',
integration_name="Findata Fetcher",
integration_version="1.0.0")
af_vault_id = await get_vault_id(client, 'Redacted')
af_item_id = await get_item_id(client, af_vault_id, 'degiro.nl')
item = await client.items.get(af_vault_id, af_item_id)
return client, af_vault_id, af_item_id, item
if __name__ == '__main__':
import asyncio
asyncio.run(main())
I am running this in the virtual environment created for Findata Fetcher by Poetry.
I added a print to items.py
and here’s the JSON response that the code in the stack trace is seeing (with redactions):
{
"id": "redacted",
"title": "degiro.nl",
"category": "Login",
"vaultId": "redacted",
"fields": [
{
"id": "username",
"title": "username",
"sectionId": null,
"fieldType": "Text",
"value": "redacted",
"details": null
},
{
"id": "password",
"title": "password",
"sectionId": null,
"fieldType": "Concealed",
"value": "redacted",
"details": null
},
{
"id": "TOTP_redacted",
"title": "one-time password",
"sectionId": "add more",
"fieldType": "Totp",
"value": "redacted",
"details": {
"type": "Otp",
"content": {
"code": "redacted",
"errorMessage": null
}
}
},
{
"id": "redacted",
"title": "mobile app code",
"sectionId": "add more",
"fieldType": "Concealed",
"value": "redacted",
"details": null
}
],
"sections": [
{
"id": "add more",
"title": ""
}
],
"version": 4
}
Looks like details
is optional after all.
I’m using Pydantic at 2.9.0, but I can also reproduce it at 2.9.1.
Hi @gregorias,
Thanks for looking into it, the optional keyword on the details
field was removed on the commits which is why you were getting this error.
This has been fixed and you shouldn't see this error anymore. If it comes up again, please feel free to re-open this issue.
Thanks!
Scenario & Reproduction Steps
I have an item that looks like this:
And I try to fetch it with
op_client.items.get(vault_id, item_id)
.Actual Behavior
The
get
function throws:Expected Behavior
The SDK should return the relevant item or at least an exception that is relevant to the caller (e.g., that the functionality is not implemented).
SDK version
0.1.1
Additional information
No response