MicroStrategy / mstrio-py

Python integration for MicroStrategy
Apache License 2.0
90 stars 60 forks source link

User.alter throws error #182

Closed wdeng58 closed 6 months ago

wdeng58 commented 7 months ago

I tried to modify attributes of user account with following code:

UserToChange = User(connection=mstr_conn, id="53B60707443E5AF7F5C3758DAC811F1D") print(UserToChange.username) UserToChange.alter(description="XYZ")

mstr_conn is a connection object with Administrator credential while UserToChange is a normal user account object.

Username of UserToChange was displayed correctly. But after that I got following errors:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/requests/models.py", line 971, in json return complexjson.loads(self.text, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/json/init.py", line 346, in loads return _default_decoder.decode(s) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/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 "/Users/deng/Documents/Job/RL/UpdateUserPassword.py", line 21, in UserToChange.alter(description="XYZ") File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/mstrio/users_and_groups/user.py", line 514, in alter self._alter_properties(properties) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/mstrio/utils/entity.py", line 810, in _alter_properties changed = self._send_proper_patch_request(properties) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/mstrio/utils/entity.py", line 783, in _send_proper_patch_request response = func(param_value_dict) ^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/mstrio/utils/response_processors/users.py", line 84, in update return users_api.update_user_info(connection=connection, id=id, body=body).json() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/requests/models.py", line 975, in json raise RequestsJSONDecodeError(e.msg, e.doc, e.pos) requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)