Пример #1
0
 def __init__(self):
     bankconfig = OnlineBankConfig()
     self.bank_addr = bankconfig.get_parameter("CLIENT", "bank_addr")
     self.bank_port = int(bankconfig.get_parameter("CLIENT", "bank_port"))
     # bank_stack = bankconfig.get_parameter("CLIENT", "stack", "default")
     self.bank_username = bankconfig.get_parameter("CLIENT", "username")
     self.certPath = os.path.join(bankconfig.path(), BANK_CERT_FILE_NAME)
     self.bank_cert = loadCertFromFile(self.certPath)
     self.bank_client = None
Пример #2
0
from CipherUtil import loadCertFromFile
from BankCore import LedgerLineStorage, LedgerLine
from OnlineBank import BankClientProtocol, OnlineBankConfig
import playground, time
import getpass, os, asyncio

bankconfig = OnlineBankConfig()
bank_addr = "20194.0.0.19000"
bank_port = 777
bank_stack = "default"
bank_username = "******"
certPath = "/home/student_20194/YU_MAO/20194_online_bank.cert"
bank_cert = loadCertFromFile(certPath)


async def example_transfer(bank_client, src, dst, amount, memo):
    await playground.create_connection(lambda: bank_client,
                                       bank_addr,
                                       bank_port,
                                       family='default')
    print("Connected. Logging in.")

    try:
        await bank_client.loginToServer()
    except Exception as e:
        print("Login error. {}".format(e))
        return False

    try:
        await bank_client.switchAccount(src)
    except Exception as e: