A simple demo to be used from command line.

def _main():
    """ A simple demo to be used from command line. """
    import sys

    def log(message):
        print(message)

    def print_usage():
        log('usage: %s <application key> <application secret> send <number> <message> <from_number>' % sys.argv[0])
        log('       %s <application key> <application secret> status <message_id>' % sys.argv[0])

    if len(sys.argv) > 4 and sys.argv[3] == 'send':
        key, secret, number, message = sys.argv[1], sys.argv[2], sys.argv[4], sys.argv[5]
        client = SinchSMS(key, secret)
        if len(sys.argv) > 6:
            log(client.send_message(number, message, sys.argv[6]))
        else:
            log(client.send_message(number, message))
    elif len(sys.argv) > 3 and sys.argv[3] == 'status':
        key, secret, message_id = sys.argv[1], sys.argv[2], sys.argv[4]
        client = SinchSMS(key, secret)
        log(client.check_status(message_id))
    else:
        print_usage()
        sys.exit(1)

    sys.exit(0)