def main():
    """Executed on run"""

    args = parse_args()
    if args.version:
        from .__init__ import __version__, __release_date__
        print('elkme %s (release date %s)' % (__version__, __release_date__))
        print('(c) 2015-2017 46elks AB <hello@46elks.com>')
        print(small_elk)
        exit(0)

    conf, conf_status = config.init_config(args)
    if not conf_status[0]:
        errors.append(conf_status[1])
    elif conf_status[1]:
        print(conf_status[1])

    message = parse_message(args)
    if conf_status[1] and not message:
        # No message but the configuration file was stored
        sys.exit(0)

    try:
        elks_conn = Elks(auth = (conf['username'], conf['password']),
                api_url = conf.get('api_url'))
    except KeyError:
        errors.append('API keys not properly set. Please refer to ' +
            '`elkme --usage`, `elkme --help` or ' +
            'https://46elks.github.io/elkme')

    if not message:
        print(USAGE, file=sys.stderr)
        exit(-1)

    for error in errors:
        print('[ERROR] {}'.format(error))
        exit(-1)
    
    options = []
    if args.flash:
        options.append('flashsms')

    try:
        send_sms(elks_conn, conf, message, length=args.length, options=options)
    except ElksException as e:
        print(e, file=sys.stderr)
def main ( ) : args = parse_args ( ) if args . version : from . __init__ import __version__ , __release_date__ print ( 'elkme %s (release date %s)' % ( __version__ , __release_date__ ) ) print ( '(c) 2015-2017 46elks AB <hello@46elks.com>' ) print ( small_elk ) exit ( 0 ) conf , conf_status = config . init_config ( args ) if not conf_status [ 0 ] : errors . append ( conf_status [ 1 ] ) elif conf_status [ 1 ] : print ( conf_status [ 1 ] ) message = parse_message ( args ) if conf_status [ 1 ] and not message : sys . exit ( 0 ) try : elks_conn = Elks ( auth = ( conf [ 'username' ] , conf [ 'password' ] ) , api_url = conf . get ( 'api_url' ) ) except KeyError : errors . append ( 'API keys not properly set. Please refer to ' + '`elkme --usage`, `elkme --help` or ' + 'https://46elks.github.io/elkme' ) if not message : print ( USAGE , file = sys . stderr ) exit ( - 1 ) for error in errors : print ( '[ERROR] {}' . format ( error ) ) exit ( - 1 ) options = [ ] if args . flash : options . append ( 'flashsms' ) try : send_sms ( elks_conn , conf , message , length = args . length , options = options ) except ElksException as e : print ( e , file = sys . stderr )
Executed on run