dimanche 6 janvier 2019

Is this a good coding practice for python?

if preset.exists('//*[@id="i0116"]', '10', '1'):
    if (log.enter_username()):
        if preset.exists('//*[@id="i0116"]', '10', '1'):
            if (log.enter_password()):
                locked = unlock(details[0], details[1], browser, ' ', ' ', ' ')
                if not (locked.checkBlocked()):
                # unlock account
                else:
                    searches = search(details[0], details[1], browser)
            else:
                browser.quit()
                continue
        else:
            browser.quit()
            continue
    else:
        browser.quit()
        continue
else:
    browser.quit()
    continue

I'm making a bot in Python and i have so much exception handling to do that i might end up with at least 5 more of these if's and else's...

Am I doing something wrong here? Should i hard code these exceptions inside of the methods themselves rather then using a control file to do it?

Aucun commentaire:

Enregistrer un commentaire