You can use the threading.Thread.join method to handle the timeout. The key to getting it working is to set the daemon attribute as shown below.
import threading
response = None
def get_response():
global response
response = input("Do you wish to reconnect? ")
thread = threading.Thread(target=get_response, daemon=True)
thread.start()
thread.join(2)
if response is None:
print()
print('Exiting')
else:
print('As you wish')