Automated config backup

Skip to first unread message

Simon Cox

Nov 28, 2018, 10:09:32 AM11/28/18
to Users Mailing List

Below is a short script that allows you to automate the backup the config of your app.

It is not sufficient simply to back-up your database if you want to restore from a complete failure.

Hope this is useful to someone

import requests

import json

import os

# change these variables (or better yet, store in a config file ;-)

login = "admin"

password = "superstrongpassword"

url = ''

downloadfolder = r'C:\Config backups'

session = requests.Session()

= json.dumps(["login",0,0,[login,password],time.time()*1000])

headers = {

   'Content-Type' : 'application-json'


r = + '/api', data=data, headers=headers)

data = json.dumps(["server",0,0,["server_export_task",[1,url]],time.time()*1000])

= + '/api', data=data)

pth = r.json()['result']['data'][0]

r = session.get(pth)

open(os.path.join(downloadfolder, os.path.basename(pth)), 'wb').write(r.content)

Dražen Babić

Nov 28, 2018, 8:44:53 PM11/28/18
to Simon Cox, Users Mailing List
Cheers mate

I tried and missing a few dependencies for python3:

pip install jsonlib-python3


Traceback (most recent call last):
File "", line 24, in <module>
data = json.dumps(["login",0,0,[login,password],time.time()*1000])
NameError: name 'time' is not defined

Any suggestion for that one?

> --
> You received this message because you are subscribed to the Google Groups
> " Users Mailing List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
> To post to this group, send email to
> To view this discussion on the web visit
> For more options, visit

Dražen Babić

Nov 28, 2018, 8:56:02 PM11/28/18
to Simon Cox, Users Mailing List

"import time" was missing :)

Awesome work, thanks!
Reply all
Reply to author
0 new messages