You should reset user&pass to original values afterwards. Preferably using a context manager for that. But I can do that for you later.