def activate_factor(self, user_id, device_id):
self.clean_error()<EOL>try:<EOL><INDENT>url = self.get_url(Constants.ACTIVATE_FACTOR_URL, user_id, device_id)<EOL>response = self.execute_call('<STR_LIT>', url)<EOL>if response.status_code == <NUM_LIT:200>:<EOL><INDENT>json_data = response.json()<EOL>if json_data and json_data.get('<STR_LIT:data>', None):<EOL><INDENT>return FactorEnrollmentResponse(json_data['<STR_LIT:data>'][<NUM_LIT:0>])<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self.error = str(response.status_code)<EOL>self.error_description = self.extract_error_message_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>
Triggers an SMS or Push notification containing a One-Time Password (OTP)
that can be used to authenticate a user with the Verify Factor call.

:param user_id: Set to the id of the user.
:type user_id: integer

:param device_id: Set to the device_id of the MFA device.
:type device_id: integer

:return: Info with User Id, Device Id, and otp_device
:rtype: FactorEnrollmentResponse

See https://developers.onelogin.com/api-docs/1/multi-factor-authentication/activate-factor Activate an Authentication Factor documentation