If scrape_log_for_code encounters a problem while streaming in the server log for authentication details it's not currently shown and it just hangs waiting on the expected text. One way to handle this is to use subprocess.Popen(..., stderr=subprocess.PIPE) and watch for errors in stderr. Possibly there's a better way to catch the error from the process directly.