def check_account(submit):
    """Checks to make sure the account was successfully created"""
    submit_page = submit.text
    success = '<p>You can now begin your adventure with your new account.</p>'
    if success in submit_page:
        print("Account was successfully created.\n")
        return True
    elif 'Warning!' in submit_page:  # If account creation fails, print the error
        print("\nAccount was not created successfully - error below:")
        error_text = submit_page[get_index(submit_page, 'Warning!', 1) + 23:]
        error_text = error_text[:get_index(error_text, '<', 1)]
        print(error_text)
        return False
    else:
        print("Account was not created successfully "
              "and we weren't able to catch the error.. ")
        print("\nThis is very likely to be an unhandled captcha solve issue.")
        return False
def check_account(submit):
    """Checks to make sure the account was successfully created"""
    submit_page = submit.text
    success = '<p>You can now begin your adventure with your new account.</p>'
    if success in submit_page:
        print("Account was successfully created.\n")
        return True
    elif 'Warning!' in submit_page: # If account creation fails, print the error
        print("\nAccount was not created successfully - error below:")
        error_text = submit_page[get_index(submit_page, 'Warning!', 1)+23:]
        error_text = error_text[:get_index(error_text, '<', 1)]
        print(error_text)
        return False
    elif 'Sorry, there was an error processing your request.' in submit_page:
        print("The account creation failed due to a temporary IP block. "
              "Rest the IP, switch proxies, etc.")
        return False
    else:
        print("Account was not created successfully "
              "and we weren't able to catch the error.. ")
        return False
def format_current_proxy(proxy):
    """Formats and returns our current proxy for CLI use"""
    # Example returned proxy:
    # {'https': 'socks5://username:[email protected]:24613\n'}
    proxy = str(proxy)
    proxy_auth_type = get_user_settings()[1]
    # Formatting shenanigans to get the strings we need for CLI usage
    if proxy_auth_type == 1: # Formatting based on user:pass@proxy:port
        proxy_username = proxy[get_index(proxy, '/', 2)+1:get_index(proxy, ':', 3)]
        proxy_password = proxy[get_index(proxy, ':', 3)+1:get_index(proxy, '@', 1)]
        proxy_host = proxy[get_index(proxy, '@', 1)+1:get_index(proxy, ':', 4)]
        proxy_port = proxy[get_index(proxy, ':', 4)+1:get_index(proxy, "'", 4)-2]

        return proxy_username, proxy_password, proxy_host, proxy_port

    else: # Formatting based on proxy:port (IP authentication)
        proxy_host = proxy[get_index(proxy, '/', 2)+1:get_index(proxy, ':', 3)]
        proxy_port = proxy[get_index(proxy, ':', 3)+1:-4]

        return proxy_host, proxy_port