Capturing key press times for a behavioral biometrics tool using Java or Python?

I’m trying to create a behavioral biometrics tool that uses keyboard usage patterns to identify the user. The idea is to capture how the user types, but not what. I thought about capturing the time it takes for the user to press and release a key, as well as time from one keypress to another.

I’ve been looking into but I’ve only found “keylogger” type of programs and tutorials, same with , which I think it’s impossible to use the way I described.

Can someone give me a hint or tutorial to do such a thing?

Thank you.