Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/uroni/urbackup-server-python-web-api-wrapper
Python wrapper to access and control an UrBackup server
https://github.com/uroni/urbackup-server-python-web-api-wrapper
Last synced: about 2 months ago
JSON representation
Python wrapper to access and control an UrBackup server
- Host: GitHub
- URL: https://github.com/uroni/urbackup-server-python-web-api-wrapper
- Owner: uroni
- License: apache-2.0
- Created: 2016-08-21T12:39:35.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2022-07-09T09:46:34.000Z (about 2 years ago)
- Last Synced: 2024-07-20T11:15:42.034Z (2 months ago)
- Language: Python
- Homepage: https://www.urbackup.org
- Size: 32.2 KB
- Stars: 37
- Watchers: 7
- Forks: 21
- Open Issues: 8
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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_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:
```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"] ) )
```