If it is possible to simplify if condition code in python.
download_mis = MisFromSite(id) check_success = download_mis.getModelObject() login_success = 'Login Failed' if check_success is None: check_success = download_mis.loginSite() login_success = check_success if check_success is None: check_success = download_mis.getMis() if check_success is None: check_success = download_mis.convertOurformat() if check_success is None: check_success = download_mis.saveModelObject() if login_success is None: check_success = download_mis.terminateLogin() I write a code to fetch data from the website. I am unable to fetch data without login. without data, I could not process the data. each and every function is relay previous function output, except terminateLogin function. once login was a success need to terminate the login cookie so terminatelogin function should run if any function executed or not.
errororsuccessbefore moving on to next step, the syntax might be strange to you, you can change it to a function ex:handle(check_success)andreturnor stop, this would make you code cleaner I think