Python wrapper to access and control an UrBackup server
Go to file
m-d-f 5b6f4a591a Update __init__.py
There's a seldom issue I encountered with a 32bit Server 2008 in which the Servername isn't formatted nicely (also not in the Webui) which brings the wrapper to a halt. Please review the adittion that solved the issue for me.
This is my first pull request whatsoever so maybe I have overseen something else in the overall procedure...
2017-01-24 23:08:44 +01:00
test Initial commit 2016-08-21 15:09:46 +02:00
urbackup_api Update __init__.py 2017-01-24 23:08:44 +01:00
.gitignore Initial commit 2016-08-21 15:09:46 +02:00
LICENSE Initial commit 2016-08-21 14:39:36 +02:00
MANIFEST.in Fix pypy dist issue 2016-08-21 15:24:37 +02:00
README.md Fix example 2016-08-21 15:30:20 +02:00
setup.cfg Initial commit 2016-08-21 15:09:46 +02:00
setup.py Incremented version 2016-10-01 14:01:38 +02:00

urbackup-server-web-api-wrapper

Python wrapper to access and control an UrBackup server

Installation

Install with:

pip3 install urbackup-server-web-api-wrapper

Usage

Start a full file backup:

import urbackup_api

server = 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:

import urbackup_api
import time
import datetime
server = urbackup_api.urbackup_server("http://127.0.0.1:55414/x", "admin", "foo")
clients = server.get_status()
diff_time = 3*24*60*60 # 3 days
for client in clients:    
    if client["lastbackup"]=="-" or client["lastbackup"] < time.time() - diff_time:
            
        if client["lastbackup"]=="-" or client["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"] ) )