There is a problem when creating a user and assigning groups to them. When creating a user, it is created normally, but when changing or adding groups to it, I get error 400 The ofrestapi python module is used. There were no problems on older versions. Occurs precisely when groups are changed or created.
>>> from ofrestapi.users import Users
>>> api = Users('http://xx.xx.xx.xx:9090', 'key')
>>> x = api.add_user(username='test', password='123456', name='test')
>>> of_groups = \[\]
>>> of_groups.append('ca')
>>> of_groups.append('it')
>>> api.add_user_groups(username='test', groups=of_groups.lower())
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'list' object has no attribute 'lower'
>>> api.add_user_groups(username='test', groups=of_groups)
Traceback (most recent call last):
File "/home/urr_karpenkovav/disk_d/Programing/Site/django/workprogs/venv/lib/python3.11/site-packages/requests/models.py", line 974, in json
return complexjson.loads(self.text, \*\*kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/\__init_\_.py", line 346, in loads
return \_default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=\_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/urr_karpenkovav/disk_d/Programing/Site/django/workprogs/venv/lib/python3.11/site-packages/ofrestapi/base.py", line 60, in \_submit_request
exception = r.json()\['exception'\]
^^^^^^^^
File "/home/urr_karpenkovav/disk_d/Programing/Site/django/workprogs/venv/lib/python3.11/site-packages/requests/models.py", line 978, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/urr_karpenkovav/disk_d/Programing/Site/django/workprogs/venv/lib/python3.11/site-packages/ofrestapi/users.py", line 117, in add_user_groups
return self.\_submit_request(post, endpoint, json=payload)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/urr_karpenkovav/disk_d/Programing/Site/django/workprogs/venv/lib/python3.11/site-packages/ofrestapi/base.py", line 63, in \_submit_request
raise InvalidResponseException(r.status_code)
ofrestapi.exception.InvalidResponseException: 400
>>>
