@aj_Brk I have used similar code as given below , but got the following exception
Exception : Object of type TOTP is not JSON serializable
but then I solved the problem
But then I added last two lines and problem solved the last two lines given at the end of the following code- qrOtp is the code generated here : https://smartapi.angelbroking.com/enable-totp below the QR Code. So you have to generate your own qrOtp code here in this site. Then Install pyotp using command line "pip install pyotp"
My Code Below ( Last line totp = totp.now() is very important)
from smartapi import SmartConnect #or from smartapi.smartConnect import SmartConnect
import config
import pyotp
client_code = "aaaaaa"
client_pass = "bbbbbb"
apiKey="yyyyyyy"
qrOtp = "xxxxxxxx"
totp = pyotp.TOTP(qrOtp)
totp = totp.now()
smartapiObj =SmartConnect(apiKey)
data = smartapiObj.generateSession(client_code,client_pass,totp)
print(data)