1Password/connect-sdk-python

Retrieve items and fields based on op://.* url

HaddadJoe opened this issue · 1 comments

Summary

Allow item details to be retrieved using it's op:// url. For example, when secret reference is created it would be nice to have the text directly retrieved by the sdk.

Use cases

It would be more secure as only that field would be pulled rather than pulling the whole secret. This would also avoid useless parsing of big dict of items returned by the api and allow direct reference of a certain field.

Proposed solution

Create .get_item_by_url that will either pull a whole item or a specific field based on the passed url. for example op://vault/item/[section/]field

Is there a workaround to accomplish this today?

Not that i'm aware of. Happy to hear if there's any?!

Hi @HaddadJoe .
Thank you very much for your proposal!
But as python sdk is just a wrapper that makes http requests to the Connect server, and the Connect server doesn't have an endpoint to retrieve a single item field, we won't have the benefits you described in the use case.

To summarise, at the current moment, we will have to retrieve the whole item anyway, and extract desired field value from it.
We would consider adding the method you offer, but only when the Connect server has an appropriate endpoint. I've raised the internal discussion within the team in that regard.

I close this issue until further notice.