示例#1
0
    def store_keys_routine():
        FOO.text("""
        So, we'll store the keys you provided.
        """)
        try:
            store_keys
        except NameError:
            FOO.text("""\
            First we need to import store_keys, which is found in src/security/key_handling.py
            """)
            
            ####################################
            ## imports are important

            from src.security.key_handling import store_keys
            FOO.echo_import (store_keys)
            FOO.text("", end = "")
            
            ####################################
            
        FOO.text("""
        Now I will call

        >> store_keys({username},{{...}},'***') # <- Your keys and password go here
        
        This function has other optional fields. Most relevantly context='OGS' is default \
        behavior, but it can be changed to 'OGS_Beta for testing.'""".format(username = repr(username)))
        
        while not FOO.flow_control_is(True):
            try:
                store_keys(username, keys, my_password)
                FOO.text("""
                We've successfully stored your keys. Now you can simply use your username and \
                password to retrieve them every time.
                """)
                FOO.change_flow(True)
            except ValueError as e:
                FOO.text("""
                Something about your keys doesn't look right...
                I got this error message: {error}
                """.format(error = e))
                ask_for_keys(force_change = True)
示例#2
0
    """,
    end ="")

    FOO.text("""
    We need to import the proper modules for this purpose:
    These files can be found at the src/security directory

    """)

    #############################
    ## imports are important

    from src.security.key_handling import get_keys_directory, set_keys_directory
    from src.security.exceptions import KeysDirectoryNotFound
    FOO.echo_import (get_keys_directory, set_keys_directory, KeysDirectoryNotFound)

    #############################

    ## Here be some console print-outs.
    ## You'll see some of those whenever you execute any
    ## of the functions mentioned here.

    ## Example:
    ## 1: @0 A reading operation begins...
    ## 2: @567 [1] You see? It took you about half a second to read the sentence in line [1].

    FOO.text("","""
    That nonsense over there is our very own event logging. Admittedly, this was programmed before becoming \
    aware that Python has logging functions on its own.
    Nevertheless this one suits our purposes: you get an entry number "n:", followed by a timestamp "@ms", \