Python wrapper to access and control an UrBackup server
Project description
# 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:
```python
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:
```python
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"] ) )
```
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:
```python
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:
```python
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"] ) )
```
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for urbackup-server-web-api-wrapper-0.5.zip
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f7c2ba6f365569c2c61bafd6af48189f3a85416c61b0e65521e4400c36057b9 |
|
MD5 | 2a93a8dfc770df0965c06bf16a5274fa |
|
BLAKE2b-256 | 483158a0d1af886a4b7795384413c352d532b58699f5fc86b9e40d7f4a07b085 |