Python wrapper to access and control an UrBackup server
Install with:
pip3 install urbackup-server-web-api-wrapper
Start a full file backup:
importurbackup_apiserver=urbackup_api.urbackup_server("http://127.0.0.1:55414/x", "admin", "foo")
server.start_full_file_backup("testclient0")List clients with no file backup in the last three days:
importurbackup_apiimporttimeimportdatetimeserver=urbackup_api.urbackup_server("http://127.0.0.1:55414/x", "admin", "foo")
clients=server.get_status()
diff_time=3*24*60*60# 3 daysforclientinclients:
ifclient["lastbackup"]=="-"orclient["lastbackup"] <time.time() -diff_time:
ifclient["lastbackup"]=="-"orclient["lastbackup"]==0:
lastbackup="Never"else:
lastbackup=datetime.datetime.fromtimestamp(client["lastbackup"]).strftime("%x %X")
print("Last file backup at {lastbackup} of client {clientname} is older than three days".format(
lastbackup=lastbackup, clientname=client["name"] ) )