Beispiel #1
0
def register(username, password):
    ## Fill in code here.
    with rpclib.client_connect('/authsvc/sock') as c:
        kwargs = {'username':username,'password':password}
        print "register kwargs=%s" % kwargs
        go = c.call('register',**kwargs)
        return go
Beispiel #2
0
def transfer(username, recipient, amount):
    with rpclib.client_connect('/jail/banksvc/sock') as c:
        ret = c.call('transfer',
                     username=username,
                     recipient=recipient,
                     amount=amount)
        return ret
Beispiel #3
0
def transfer(sender, recipient, zoobars, token):
    with rpclib.client_connect('/banksvc/sock') as cc:
        return cc.call('transfer',
                       sender=sender,
                       recipient=recipient,
                       zoobars=zoobars,
                       token=token)
Beispiel #4
0
def run_profile(username):
    try:
        with rpclib.client_connect('/profilesvc/sock') as c:
            return c.call('run', user=username, visitor=g.user.person.username)
    except Exception, e:
        traceback.print_exc()
        return 'Exception: ' + str(e)
Beispiel #5
0
def check_token(username, token):
    ## Fill in code here.
    with rpclib.client_connect('/authsvc/sock') as c:
        kwargs = {'username': username, 'token': token}
        ret = c.call('check_token', **kwargs)
        #ret = c.call('check_token', username=username, token=token)
        return ret
Beispiel #6
0
def login(username, password):
    ## Fill in code here.
    with rpclib.client_connect('/authsvc/sock') as c:
        kwargs = {'username': username, 'password': password}
        ret = c.call('login', **kwargs)
        #ret = c.call('login', username=username, password=password)
        return ret
Beispiel #7
0
def transfer(sender, recipient, zoobars, token):
    with rpclib.client_connect(sockpath) as c:
        return c.call('transfer',
                      sender=sender,
                      recipient=recipient,
                      zoobars=zoobars,
                      token=token)
Beispiel #8
0
def transfer(sender,recipient,zoobars,token):
    try:
        with rpclib.client_connect('/banksvc/sock') as c:
            ret = c.call('transfer',sender=sender,recipient=recipient,zoobars=zoobars,token=token)
            return ret
    except Exception:
        return ValueError("Error")
Beispiel #9
0
def post(transaction_id, signed_receipt):
    with rpclib.client_connect('/authsvc/sock') as rpc_client:
        keyword_args = {
            'transaction_id': transaction_id,
            'signed_receipt': signed_receipt
        }
        return rpc_client.call('post', **keyword_args)
Beispiel #10
0
def transfer(sender, recipient, zoobars, token):
    ## Fill in code here.
    with rpclib.client_connect('/banksvc/sock') as c:
        c.call('transfer',
               sender=sender,
               recipient=recipient,
               zoobars=zoobars,
               token=token)
Beispiel #11
0
def transfer(sender, recipient, zoobars, token):
    ## Fill in code here.
    socket = "/banksvc/sock"
    kwargs = {
        'sender': sender,
        'recipient': recipient,
        'zoobars': zoobars,
        'token': token
    }
    with rpclib.client_connect(socket) as r:
        return r.call('transfer', **kwargs)
Beispiel #12
0
def run_profile(user):
    try:
        pcode = user.profile.encode('ascii', 'ignore')
        pcode = pcode.replace('\r\n', '\n')
        with rpclib.client_connect('/profilesvc/sock') as c:
            return c.call('run', pcode=pcode,
                                 user=user.username,
                                 visitor=g.user.person.username)
    except Exception, e:
        traceback.print_exc()
        return 'Exception: ' + str(e)
Beispiel #13
0
def run_profile(user):
    try:
        pcode = user.profile
        pcode = pcode.replace('\r\n', '\n')
        host = readconf.read_conf().lookup_host('profile')
        with rpclib.client_connect(host) as c:
            return c.call('run', pcode=pcode,
                                 user= user.username,
                                 visitor=g.user.person.username)
    except Exception as e:
        traceback.print_exc()
        return 'Exception: ' + str(e)
Beispiel #14
0
def lookup(transaction_id):
    with rpclib.client_connect('/authsvc/sock') as rpc_client:
        keyword_args = {'transaction_id': transaction_id}
        return rpc_client.call('lookup', **keyword_args)
Beispiel #15
0
def get_log(username):
    with rpclib.client_connect('/banksvc/sock') as cc :
        return cc.call('get_log', username=username)
Beispiel #16
0
def transfer(sender, recipient, zoobars, token):
    with rpclib.client_connect('/banksvc/sock') as cc :
        return cc.call('transfer', sender=sender, recipient=recipient, zoobars=zoobars, token=token)
Beispiel #17
0
def register(username):
    ## Fill in code here.
    with rpclib.client_connect('/banksvc/sock') as c:
        return c.call('register', username=username)
Beispiel #18
0
def make_bank(username):
    with rpclib.client_connect('/banksvc/sock') as c:
        ret = c.call('make_bank', username = username)
        return ret
Beispiel #19
0
def process_check(check):
    with rpclib.client_connect('/banksvc/sock') as rpc_client:
        keyword_args = {'check': check}
        return rpc_client.call('process_check', **keyword_args)
Beispiel #20
0
def validate(sender, token):
    arguments = {'username': sender, 'token': token}
    conn2 = rpclib.client_connect("/authsvc/sock")
    return conn2.call('check_token', **arguments)
Beispiel #21
0
def transfer(sender, recepient, token,zoobars):
    ## Fill in code here.
    with rpclib.client_connect('/banksvc/sock') as c:
        return c.call('transfer', zsender = sender, zrecepient = recepient, ztoken = token, czoobars = zoobars)
Beispiel #22
0
def balance(username):
    ## Fill in code here.
    with rpclib.client_connect('/banksvc/sock') as c:
        ret = c.call('balance', uname = username)
        return ret
Beispiel #23
0
def setup(username):
    with rpclib.client_connect('/banksvc/sock') as c:
        c.call('setup', uname = username)
def register(username, password):
    ## Fill in code here.
    with rpclib.client_connect('/authsvc/sock') as c:
        token = c.call('register',user_name=username,pass_word=password )
        return token
Beispiel #25
0
def getString(username):
    with rpclib.client_connect('/jail/stringsvc/sock') as c:
        ret = c.call('getString', username = username)
        return ret
Beispiel #26
0
def login(username, password):
    with rpclib.client_connect(sockpath) as c:
        return c.call('login', username=username, password=password)
Beispiel #27
0
def register(username, password):
    with rpclib.client_connect('/authsvc/sock') as rpc_client:
        keyword_args = {"username":username, "password":password}
        return rpc_client.call('register', **keyword_args)
Beispiel #28
0
def display(username):
    with rpclib.client_connect('/banksvc/sock') as rpc_client:
        keyword_args = {'username':username}
        return rpc_client.call('display', **keyword_args)
Beispiel #29
0
def login(userName, passWord):
    with rpclib.client_connect('/jail/loginsvc/sock') as c:
        ret = c.call('login', username = userName, password = passWord)
        return ret
Beispiel #30
0
def check_token(username, token):
    with rpclib.client_connect('/authsvc/sock') as rpc_client:
        keyword_args = {"username":username, "token":token}
        return rpc_client.call('check_token', **keyword_args)
Beispiel #31
0
def balance(username):
    with rpclib.client_connect('/banksvc/sock') as rpc_client:
        keyword_args = {'username':username}
        return rpc_client.call('balance', **keyword_args)
Beispiel #32
0
def getString(username):
    with rpclib.client_connect('/stringsvc/sock') as c:
        ret = c.call('getString', username = username)
        return ret
Beispiel #33
0
def register(username):
    with rpclib.client_connect('/banksvc/sock') as rpc_client:
        keyword_args = {'username':username}
        return rpc_client.call('register', **keyword_args)
Beispiel #34
0
from debug import *
from zoodb import *
import rpclib

socket = "/authsvc/sock"
conn = rpclib.client_connect(socket)

def login(username, password):
    ## Fill in code here.
    arguments = {'username': username, 'password': password}
    return conn.call('login', **arguments)

def register(username, password):
    ## Fill in code here.
    kwargs = {}#{'username': username, 'password': password}
    kwargs['username'] = username
    kwargs['password'] = password
    return conn.call('register', **kwargs)

def check_token(username, token):
    ## Fill in code here.
    arguments = {'username': username, 'token': token}
    return conn.call('check_token', **arguments)

Beispiel #35
0
def balance(username):
    with rpclib.client_connect('/banksvc/sock') as c:
        kwargs = {'username': username}
        ret = c.call('balance', **kwargs)
        return ret
Beispiel #36
0
def check_in(username):
    with rpclib.client_connect('/banksvc/sock') as c:
        kwargs = {'username': username}
        print "bank_client check_in  kwargs=%s" % kwargs
        ret = c.call('check_in', **kwargs)
        return ret
Beispiel #37
0
def getToken(username):
    with rpclib.client_connect('/authsvc/sock') as c:
        ret = c.call('getToken', username = username)
        return ret
Beispiel #38
0
def register(username):
    with rpclib.client_connect('/banksvc/sock') as cc :
        return cc.call('register', username=username)
Beispiel #39
0
def login(username, password):
    ## Fill in code here.
    with rpclib.client_connect('/authsvc/sock') as c:
        ret = c.call('login',user = username,passd = password)
        return ret
Beispiel #40
0
def balance(username):
    with rpclib.client_connect('/banksvc/sock') as cc :
        return cc.call('balance', username=username)
Beispiel #41
0
def register(username, password):
    with rpclib.client_connect(sockpath) as c:
        return c.call('register', username=username, password=password)
Beispiel #42
0
def check_token(username, token):
    ## Fill in code here.
    with rpclib.client_connect('/authsvc/sock') as c:
        ret = c.call('check_token', uname = username, token = token)
        return ret
Beispiel #43
0
def check_token(userName, Token):
    with rpclib.client_connect('/authsvc/sock') as c:
        ret = c.call('check_token', username=userName, token=Token)
        return ret
Beispiel #44
0
def get_log(username):
    with rpclib.client_connect('/banksvc/sock') as c:
        kwargs = {'username': username}
        print "bank_client get_log kwargs=%s" % kwargs
        ret = c.call('get_log', **kwargs)
        return ret
Beispiel #45
0
def login(username, password):
    ## Fill in code here.
    with rpclib.client_connect('/authsvc/sock') as c:
        ret = c.call('login', uname = username, pword = password)
        return ret
Beispiel #46
0
def transfer(sender, recipient, zoobars):
    with rpclib.client_connect('/banksvc/sock') as c:
        kwargs = {'sender': sender, 'recipient': recipient, 'zoobars': zoobars}
        ret = c.call('transfer', **kwargs)
        return ret
Beispiel #47
0
def register(userName, passWord):
    with rpclib.client_connect('/loginsvc/sock') as c:
        ret = c.call('register', username=userName, password=passWord) 
        return ret
Beispiel #48
0
def check_token(username, token):
    ## Fill in code here.
    with rpclib.client_connect('/authsvc/sock') as c:
        ret = c.call('check_token',user = username,token = token)
        return ret
def echo(args):
    return kw_sorted(args)

def test_random(c, func, expect, alphabet):
    for _ in range(20):
        args = gen_args(alphabet)
        call_check(c, func, args, expect(args))

def test_random_types(c, func, expect, choices):
    for _ in range(20):
        args = {}
        for _ in range(5):
            args[gen_string(string.ascii_letters)] = random.choice(choices)
        call_check(c, func, args, expect(args))

with rpclib.client_connect(sockname) as c:
    print 'Testing simple RPC..'
    test_simple(c)

    for func, expect in (('hash', hash), ('echo', echo),):
        print 'Testing alphanumerics..'
        alphabet = string.ascii_letters + string.digits
        test_random(c, func, expect, alphabet)

        print 'Testing punctuation..'
        alphabet += string.punctuation
        test_random(c, func, expect, alphabet)

        print 'Testing whitespace..'
        alphabet += string.whitespace
        test_random(c, func, expect, alphabet)
Beispiel #50
0
import rpclib
from debug import *

sockname = "/honeycheckersvc/sock"
c = rpclib.client_connect(sockname)


def set(username, index):
    kwargs = {}
    kwargs['username'] = username
    kwargs['index'] = index
    return c.call('set', **kwargs)


def check(username, index):
    kwargs = {}
    kwargs['username'] = username
    kwargs['index'] = index
    return c.call('check', **kwargs)
Beispiel #51
0
def echo():
    with rpclib.client_connect('/echosvc/sock') as c:
        ret = c.call('echo', s=request.args.get('s', ''))
        return render_template('echo.html', s=ret)
Beispiel #52
0
def check_token(username, token):
    with rpclib.client_connect(sockpath) as c:
        return c.call('check_token', username=username, token=token)
Beispiel #53
0
def get_log(username):
    ## Fill in code here.
    with rpclib.client_connect('/banksvc/sock') as c:
        return c.call('get_log', username=username)
Beispiel #54
0
def balance(username):
    ## Fill in code here.
    with rpclib.client_connect('/banksvc/sock') as c:
        return c.call('balance', username=username)
Beispiel #55
0
def update_client_key(username, key):
    with rpclib.client_connect('/banksvc/sock') as rpc_client:
        keyword_args = {'username':username, 'key': key}
        return rpc_client.call('update_client_key', **keyword_args)
Beispiel #56
0
def default_ten(username):
    with rpclib.client_connect('/banksvc/sock') as c:
        c.call('default_ten', username=username)
Beispiel #57
0
def transfer(username, recipient, amount):
    with rpclib.client_connect('/banksvc/sock') as c:
        ret = c.call('transfer', username = username, recipient = recipient, amount = amount)
        return ret
from debug import *
from zoodb import *
import rpclib

sockname = "/banksvc/sock"
c = rpclib.client_connect(sockname)

def transfer(sender, recipient, zoobars, token):
    kwargs = {}
    kwargs['sender'] = sender
    kwargs['recipient'] = recipient
    kwargs['zoobars'] = zoobars
    kwargs['token'] = token
    return c.call('transfer', **kwargs)
    
def balance(username):
    kwargs = {}
    kwargs['username'] = username
    return c.call('balance', **kwargs)
            
def get_log(username):
    kwargs = {}
    kwargs['username'] = username
    return c.call('get_log', **kwargs)

def setup(username):
    kwargs = {}
    kwargs['username'] = username
    return c.call('setup', **kwargs)
            
Beispiel #59
0
def viewBalance(username):
    with rpclib.client_connect('/banksvc/sock') as c:
        ret = c.call('balance', username = username)
        return ret