import json

from collections import defaultdict

# Test values
c42Lib.cp_host = "http://demo.code42.com"
c42Lib.cp_port = "4280"

master_cp_host = c42Lib.cp_host
master_cp_port = c42Lib.cp_port

c42Lib.cp_username = "******"
c42Lib.cp_password = getpass.getpass()
c42Lib.cp_logLevel = "INFO"
c42Lib.cp_logFileName = "pushRestore.log"
c42Lib.setLoggingLevel()

sourceComputer="C02M50TZFH04"
targetComputer="ROBERTS-WIN7"
restoreFile="/Users/amir.kader/Documents/test/amir.png"
restorePath="C:/Users/Robert/Desktop/restore"

print 'calling api/Computer to get guid of target computer: ' + targetComputer 
params = {}
params['q'] = targetComputer
params['active'] = 'true'
payload = {}
r = c42Lib.executeRequest("get", c42Lib.cp_api_computer, params, payload)
content = r.content
binary = json.loads(content)
targetGUID = binary['data']['computers'][0]['guid'] 
示例#2
0
from dateutil.relativedelta import *
import datetime
import calendar
import getpass

#Test values
c42Lib.cp_host = "http://aj-proappliance"
c42Lib.cp_port = "4280"
c42Lib.cp_username = "******"
c42Lib.cp_password = getpass.getpass(
    'Enter your CrashPlan console password: '******'guid', 'deviceName', 'osName', 'lastCompletedBackup', 'percentComplete',
cp_loggingLevel         = arguments['--logLevel']           # Logging Level.  Defaults to INFO.  DEBUG and ERROR are Options


start_time = time.time()
elapsed_time = 0

c42Lib.cp_logLevel = "INFO" # Will be overwritten if --logLevel is set

c42Lib.cp_logFileName = __file__+"-"+todayonly+".log"

if cp_loggingToScreen:
	showInConsole=True  #If the flag is present, turn off logging in console
else:
	showInConsole=False

c42Lib.setLoggingLevel(showInConsole=showInConsole,loggingLevel=cp_loggingLevel)
logging.info(__file__ + ' v' + versionNumber)

logging.debug(arguments)

# print deviceGuids

totalcount = 0
totalAvailableCount = 0
devicesProcessed = 0

availableList = []


# All Orgs?
cp_loggingLevel = arguments[
    '--logLevel']  # Logging Level.  Defaults to INFO.  DEBUG and ERROR are Options

start_time = time.time()
elapsed_time = 0

c42Lib.cp_logLevel = "INFO"  # Will be overwritten if --logLevel is set

c42Lib.cp_logFileName = __file__ + "-" + todayonly + ".log"

if cp_loggingToScreen:
    showInConsole = True  #If the flag is present, turn off logging in console
else:
    showInConsole = False

c42Lib.setLoggingLevel(showInConsole=showInConsole,
                       loggingLevel=cp_loggingLevel)
logging.info(__file__ + ' v' + versionNumber)

logging.debug(arguments)

# print deviceGuids

totalcount = 0
totalAvailableCount = 0
devicesProcessed = 0

availableList = []

# All Orgs?

orgList = None