Пример #1
0
def test_json_rpc():
    thread=api.reqthread()
    thread.daemon = True
    thread.start()
    time.sleep(.1)

    url = 'http://localhost:' + str(config.RPC_PORT) + '/jsonrpc'
    headers = {'content-type': 'application/json'}

    payloads = []
    payloads.append({
        "method": "get_balances",
        "params": {"address": source_default, "asset": None},
        "jsonrpc": "2.0",
        "id": 0,
    })

    for payload in payloads:
        response = requests.post(
            url, data=json.dumps(payload), headers=headers).json()
        print(response['result'])   # TODO
        try:
            output_new['rpc.' + payload['method']] = response['result']
        except:
            output_new['rpc.' + payload['method']] = response['error']
        assert response['jsonrpc'] == '2.0'
        assert response['id'] == 0
Пример #2
0
def test_json_rpc():
    thread = api.reqthread()
    thread.daemon = True
    thread.start()
    time.sleep(.1)

    url = 'http://localhost:' + str(config.RPC_PORT) + '/jsonrpc'
    headers = {'content-type': 'application/json'}

    payloads = []
    payloads.append({
        "method": "get_balances",
        "params": {
            "address": source_default,
            "asset": None
        },
        "jsonrpc": "2.0",
        "id": 0,
    })

    for payload in payloads:
        response = requests.post(url,
                                 data=json.dumps(payload),
                                 headers=headers).json()
        print(response['result'])  # TODO
        try:
            output_new['rpc.' + payload['method']] = response['result']
        except:
            output_new['rpc.' + payload['method']] = response['error']
        assert response['jsonrpc'] == '2.0'
        assert response['id'] == 0
Пример #3
0
                    print(str(table))
                    print()
        for asset in totals.keys():
            balance = totals[asset]
            total_table.add_row([asset, round(balance, 8)])
        print('TOTAL')
        print(str(total_table))
        print()

    elif args.action == 'market':
        while True:
            market(args.give_asset, args.get_asset)

    elif args.action == 'purge':
        blocks.purge(db)
           
    elif args.action == 'help':
        parser.print_help()

    elif args.action == 'server':
        thread=api.reqthread()
        thread.daemon = True
        thread.start()

        blocks.follow(db)

    else:
        parser.print_help()

# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
Пример #4
0
                    print(str(table))
                    print()
        for asset in totals.keys():
            balance = totals[asset]
            total_table.add_row([asset, round(balance, 8)])
        print('TOTAL')
        print(str(total_table))
        print()

    elif args.action == 'market':
        while True:
            market(args.give_asset, args.get_asset)

    elif args.action == 'purge':
        blocks.purge(db)
           
    elif args.action == 'help':
        parser.print_help()

    elif args.action == 'server':
        thread=api.reqthread()
        thread.daemon = True
        thread.start()

        blocks.follow(db)

    else:
        parser.print_help()

# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4