Craftserve.pl Python backup script

Some time ago I created a little script to automate backups from my Craftserve.pl server.

It requires Python 3.x with requests installed (pip install requests)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import requests, shutil, datetime

# Configuration.

mail = '[email protected]'
password = 'password'
sid = '602959'
folder = 'world'

# Code.

fileName = datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S") + '.zip'
s = requests.session()
login = {'email': mail, 'password': password, 'send': ''}
r = s.post('https://craftserve.pl/login', login)
r.raise_for_status()


r = s.get('https://craftserve.pl/s/' + sid + '/files/' + folder + '?zip=1', stream=True)
r.raise_for_status()
with open(fileName, 'wb') as f:
shutil.copyfileobj(r.raw, f)

You can extend it by adding Discord notifications, uploading files to cloud or sending commands to console, for example:

1
s.post('https://craftserve.pl/s/' + sid + '/console', 'save-off')
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×