def set_custom_attribute_to_user(self, user_id, custom_attributes):
self.clean_error()<EOL>try:<EOL><INDENT>url = self.get_url(Constants.SET_CUSTOM_ATTRIBUTE_TO_USER_URL, user_id)<EOL>data = {<EOL>'<STR_LIT>': custom_attributes<EOL>}<EOL>response = self.execute_call('<STR_LIT>', url, json=data)<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>return self.handle_operation_response(response)<EOL><DEDENT>else:<EOL><INDENT>self.error = str(response.status_code)<EOL>self.error_description = self.extract_error_message_from_response(response)<EOL>self.error_attribute = self.extract_error_attribute_from_response(response)<EOL><DEDENT><DEDENT>except Exception as e:<EOL><INDENT>self.error = <NUM_LIT><EOL>self.error_description = e.args[<NUM_LIT:0>]<EOL><DEDENT>return False<EOL>
Set Custom Attribute Value

:param user_id: Id of the user
:type user_id: int

:param custom_attributes: Provide one or more key value pairs composed of the custom attribute field shortname and the value that you want to set the field to.
:type custom_attributes: dict

Returns if the action succeed
:return: true if success
:rtype: bool

See https://developers.onelogin.com/api-docs/1/users/set-custom-attribute Set Custom Attribute Value documentation