Python3 client fails to serialize attributes
The Python3 Ibis client fails to serialize attributes when POST
ing or PUT
ing updates.
For example, the following:
person = person_methods.getPerson('crsid', 'wgd23', 'firstName')
nameAttr = next((attr for attr in person.attributes if attr.scheme == 'firstName'), None)
nameAttr.value = "Updated - Monty"
person_methods.updateAttribute('csrid', 'wgd23', nameAttr.attrid, nameAttr)
Fails with
Traceback (most recent call last):
File "/Users/montydawson/dev/debug/test-update-email.py", line 31, in <module>
main()
File "/Users/montydawson/dev/debug/test-update-email.py", line 12, in main
emailAttribute.encoded_string()
File "/Users/montydawson/dev/debug/env/lib/python3.9/site-packages/ucamlookup/ibisclient/dto.py", line 750, in encoded_string
result = "scheme:%s" % base64.b64encode(self.scheme)
File "/Users/montydawson/.pyenv/versions/3.9.1/lib/python3.9/base64.py", line 58, in b64encode
encoded = binascii.b2a_base64(s, newline=False)
TypeError: a bytes-like object is required, not 'str'
The problem is in IbisAttribute.encoded_string
which attempts to base64 encode a string, which first needs to be converted to bytes.