Ejemplo n.º 1
0
def call_client(method, args=None):
    if args is None:
        args = {}
    method = {
        'printers': 'getprinters',
        'ports': 'getports',
        'jobs': 'getjobs',
        'position': 'extendedposition',
        'pause': 'pause',
    }.get(method, method)
    if method == 'connect':
        args = {
            'machine_name': None,
            'port_name': None,
            'driver_name': None,
            'profile_name': None,
            'persistent': False,
        }
    code, data = call(config, method, args)
    if code == 0:
        data = dict(success=True, result=data)
    else:
        data = dict(success=False)
    return data