11from __future__ import annotations
22
3+ import logging
34from enum import Enum
45from http import HTTPStatus
56
89from ._product import BaseProduct
910from ._response import BaseResponse , ErrorResponse , decode_response
1011
12+ logger = logging .getLogger (__name__ )
13+
1114
1215class OTPLanguage (str , Enum ):
1316 ENGLISH = "en"
@@ -86,9 +89,7 @@ def send(
8689 raise ValueError (msg )
8790
8891 data = decode_response (response .content , type = OTPSendResponse )
89- if self .debug :
90- print (f"successfully sent OTP { data .otp_id } to { to } " )
91-
92+ logger .debug ("successfully sent OTP %r to %r" , data .otp_id , to )
9293 return data
9394
9495 def resend (self , otp_id : str , / ) -> OTPResendResponse :
@@ -105,9 +106,7 @@ def resend(self, otp_id: str, /) -> OTPResendResponse:
105106 raise ValueError (msg )
106107
107108 data = decode_response (response .content , type = OTPResendResponse )
108- if self .debug :
109- print (f"successfully resent OTP { otp_id } with status: { data .resent } " )
110-
109+ logger .debug ("successfully resent OTP %r with status: %r" , otp_id , data .resent )
111110 return data
112111
113112 def verify (self , otp : int | str , / , * , otp_id : str ) -> OTPVerifyResponse :
@@ -125,7 +124,5 @@ def verify(self, otp: int | str, /, *, otp_id: str) -> OTPVerifyResponse:
125124 raise ValueError (msg )
126125
127126 data = decode_response (response .content , type = OTPVerifyResponse )
128- if self .debug :
129- print (f"successfully verified OTP ({ otp } ) with status: { data .verified } " )
130-
127+ logger .debug ("successfully verified OTP %r with status: %r" , otp_id , data .verified )
131128 return data
0 commit comments