So you want a script that give you a latest otp from your gmail account. Its possible to do this and i can make a script for you in java that usage selenium webdriver to get a gmail otp. I am waiting for your response.
I understand your requirements. It is very possible and I can do it with selenium webdriver python. I think further details should be discussed in chat. Thank you