1Password / onepassword-sdk-python

https://developer.1password.com/docs/sdks/
MIT License
86 stars 10 forks source link

Improve Example Code to Correctly Error Out when OP_SERVICE_ACCOUNT_TOKEN is not set. #95

Closed MOmarMiraj closed 3 months ago

MOmarMiraj commented 3 months ago

This MR will update example.py to show the correct error message when OP_SERVICE_ACCOUNT_TOKEN is empty.

Before it would show this error: onepassword.lib.aarch64.op_uniffi_core.Error.Error: msg='invalid type: null, expected a string at line 1 column 28'

This was due to os.getenv setting the value of token to None when its empty instead of setting it as an empty string.

Updated the code to ensure that if the OP_SERVICE_ACCOUNT_TOKEN is empty than assign it as an empty string.