Example #1
0
def main():
    import optparse
    parser = optparse.OptionParser(__doc__.strip())
    utils.add_userpass(parser)

    parser.add_option(
        '-c',
        '--codec',
        action='store',
        default=None,
        help="Codec to use to store the messages in the dumpfile.")

    parser.add_option('-p',
                      '--port',
                      action='store',
                      type='int',
                      default=5970,
                      help="Port for the server to listen on.")

    parser.add_option('-o',
                      '-d',
                      '--dumpfile',
                      action='store',
                      help="Name of a dumpfile to use to store messages.")

    parser.add_option('-g',
                      '--group',
                      action='store',
                      help=("Set the group for the output files "
                            "(e.g. the dumpfile)."))

    parser.add_option('--offline',
                      action='store_false',
                      dest='online',
                      default=True,
                      help=("Don't even try to connect, we're offline. "
                            "Generate random data."))

    opts, args = parser.parse_args()
    utils.check_userpass(parser, opts)
    logging.basicConfig(level=logging.INFO,
                        format='%(asctime)s [%(levelname)-8s]  %(message)s')

    if opts.group:
        try:
            _, _, opts.gid, _ = grp.getgrnam(opts.group)
        except KeyError:
            parser.error("Invalid group '%s'." % opts.group)

    # Log-in to the OANDA system.
    logging.info('-' * 80)
    if opts.online:
        fxclient = opts.ClientClass()
        fxclient.setWithRateThread(True)
        fxclient.setWithLoadableKey(True)
        try:
            fxclient.login(opts.username, opts.password)
        except OAException, e:
            logging.error("Could not login: %s" % e)
            return EXIT_CANNOTLOGIN
Example #2
0
def main():
    import optparse
    parser = optparse.OptionParser(__doc__.strip())
    utils.add_userpass(parser)

    parser.add_option('-m',
                      '--dispatch-method',
                      metavar='METHOD',
                      action='store',
                      type='choice',
                      choices=dispatching_methods.keys(),
                      default='blocking',
                      help=("Selects method of dispatching events (%s)." %
                            ','.join(dispatching_methods.keys())))

    parser.add_option('-d',
                      '--delay',
                      action='store',
                      type='int',
                      default=60,
                      help="Nb. of seconds to exit after monitoring.")

    opts, args = parser.parse_args()
    utils.check_userpass(parser, opts)

    fxclient = opts.ClientClass()
    fxclient.setWithRateThread(True)
    try:
        fxclient.login(opts.username, opts.password)
    except OAException, e:
        raise SystemExit("Could not login: %s" % e)
Example #3
0
def main():
    import optparse
    parser = optparse.OptionParser(__doc__.strip())
    utils.add_userpass(parser)
    opts, args = parser.parse_args()
    utils.check_userpass(parser, opts)

    print 'Logging in.'
    fxclient = opts.ClientClass()
    try:
        fxclient.login(opts.username, opts.password)
    except OAException, e:
        raise SystemExit("Could not login: %s" % e)
Example #4
0
def main():
    import optparse
    parser = optparse.OptionParser(__doc__.strip())
    utils.add_userpass(parser)
    opts, args = parser.parse_args()
    utils.check_userpass(parser, opts)
        
    print 'Logging in.'
    fxclient = opts.ClientClass()
    try:
        fxclient.login(opts.username, opts.password)
    except OAException, e:
        raise SystemExit("Could not login: %s" % e)
Example #5
0
def main():
    import optparse

    parser = optparse.OptionParser(__doc__.strip())
    utils.add_userpass(parser)

    parser.add_option(
        "-c", "--codec", action="store", default=None, help="Codec to use to store the messages in the dumpfile."
    )

    parser.add_option(
        "-p", "--port", action="store", type="int", default=5970, help="Port for the server to listen on."
    )

    parser.add_option("-o", "-d", "--dumpfile", action="store", help="Name of a dumpfile to use to store messages.")

    parser.add_option(
        "-g", "--group", action="store", help=("Set the group for the output files " "(e.g. the dumpfile).")
    )

    parser.add_option(
        "--offline",
        action="store_false",
        dest="online",
        default=True,
        help=("Don't even try to connect, we're offline. " "Generate random data."),
    )

    opts, args = parser.parse_args()
    utils.check_userpass(parser, opts)
    logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)-8s]  %(message)s")

    if opts.group:
        try:
            _, _, opts.gid, _ = grp.getgrnam(opts.group)
        except KeyError:
            parser.error("Invalid group '%s'." % opts.group)

    # Log-in to the OANDA system.
    logging.info("-" * 80)
    if opts.online:
        fxclient = opts.ClientClass()
        fxclient.setWithRateThread(True)
        fxclient.setWithLoadableKey(True)
        try:
            fxclient.login(opts.username, opts.password)
        except OAException, e:
            logging.error("Could not login: %s" % e)
            return EXIT_CANNOTLOGIN
Example #6
0
def main():
    import optparse

    parser = optparse.OptionParser(__doc__.strip())
    utils.add_userpass(parser)
    opts, args = parser.parse_args()
    utils.check_userpass(parser, opts)

    logging.basicConfig(level=logging.INFO, format="%(levelname)-8s: %(message)s")

    fxclient = opts.ClientClass()
    fxclient.setWithRateThread(True)
    fxclient.setWithKeepAliveThread(True)
    try:
        fxclient.login(opts.username, opts.password)
    except OAException, e:
        raise SystemExit("Could not login: %s" % e)
Example #7
0
def main():
    import optparse
    parser = optparse.OptionParser(__doc__.strip())
    utils.add_userpass(parser)
    opts, args = parser.parse_args()
    utils.check_userpass(parser, opts)

    logging.basicConfig(level=logging.INFO,
                        format='%(levelname)-8s: %(message)s')

    fxclient = opts.ClientClass()
    fxclient.setWithRateThread(True)
    fxclient.setWithKeepAliveThread(True)
    try:
        fxclient.login(opts.username, opts.password)
    except OAException, e:
        raise SystemExit("Could not login: %s" % e)
Example #8
0
def main():
    import optparse
    parser = optparse.OptionParser(__doc__.strip())
    utils.add_userpass(parser)

    parser.add_option('-m', '--dispatch-method', metavar='METHOD',
                      action='store', type='choice',
                      choices=dispatching_methods.keys(), default='blocking',
                      help=("Selects method of dispatching events (%s)." %
                            ','.join(dispatching_methods.keys())))

    parser.add_option('-d', '--delay', action='store', type='int',
                      default=60,
                      help="Nb. of seconds to exit after monitoring.")

    opts, args = parser.parse_args()
    utils.check_userpass(parser, opts)

    fxclient = opts.ClientClass()
    fxclient.setWithRateThread(True)
    try:
        fxclient.login(opts.username, opts.password)
    except OAException, e:
        raise SystemExit("Could not login: %s" % e)