1Password / connect-sdk-python

Python SDK for 1Password Connect
https://developer.1password.com/docs/connect
MIT License
200 stars 31 forks source link

Invalid value for `type` (OTP), must be one of ['STRING', 'EMAIL', 'CONCEALED', 'URL', 'TOTP', 'DATE', 'MONTH_YEAR', 'MENU'] #12

Closed dslip closed 3 years ago

dslip commented 3 years ago

Your environment

SDK Version: 1.0.1

Connect Server Version: 1.0.0

OS: Windows10

Python Version: 3.9.4

What happened?

attempting to retrieve data client.get_item("vaultID","itemID")

What did you expect to happen?

Should have returned item details1

Steps to reproduce

  1. create a login on the 1password website, set a field to be used as a one time password with code then attempt to retrieve the data

Notes & Logs

Traceback (most recent call last): File "c:\python_testing\1password-test.py", line 14, in print(client.get_item("vaultID--retracted", "itemID--retracted")) File "C:\Python39\lib\site-packages\onepasswordconnectsdk\client.py", line 76, in get_item return self.deserialize(response.content, "Item") File "C:\Python39\lib\site-packages\onepasswordconnectsdk\client.py", line 294, in deserialize return self.deserialize(data, response_type) File "C:\Python39\lib\site-packages\onepasswordconnectsdk\client.py", line 377, in deserialize return self.deserialize_model(data, klass) File "C:\Python39\lib\site-packages\onepasswordconnectsdk\client.py", line 461, in deserialize_model kwargs[attr] = self.deserialize(value, attr_type) File "C:\Python39\lib\site-packages\onepasswordconnectsdk\client.py", line 354, in deserialize return [self.deserialize(sub_data, sub_kls) for sub_data in data] # noqa: E501 File "C:\Python39\lib\site-packages\onepasswordconnectsdk\client.py", line 354, in return [self.deserialize(sub_data, sub_kls) for sub_data in data] # noqa: E501 File "C:\Python39\lib\site-packages\onepasswordconnectsdk\client.py", line 377, in deserialize return self.deserialize_model(data, klass) File "C:\Python39\lib\site-packages\onepasswordconnectsdk\client.py", line 463, in __deserialize_model instance = klass(**kwargs) File "C:\Python39\lib\site-packages\onepasswordconnectsdk\models\field.py", line 70, in init self.type = type File "C:\Python39\lib\site-packages\onepasswordconnectsdk\models\field.py", line 144, in type raise ValueError( ValueError: Invalid value for type (OTP), must be one of ['STRING', 'EMAIL', 'CONCEALED', 'URL', 'TOTP', 'DATE', 'MONTH_YEAR', 'MENU']

jillianwilson commented 3 years ago

Thanks for the issue creation. The fix is here and will be pushed in the next release. However, resolving this issue also revealed an issue in the Connect server, thus you will need to upgrade to version 1.2 or higher of Connect in order to successfully use an OTP field.