99import os
1010import binascii
1111import logging
12+ from enum import Enum
1213logger = logging .getLogger ('urbackup-server-python-api-wrapper' )
1314
15+ class installer_os (Enum ):
16+ Windows = "windows" ,
17+ Linux = "linux"
1418
1519class urbackup_server :
1620
@@ -101,7 +105,7 @@ def _get_json(self, action, params = {}):
101105
102106 def _download_file (self , action , outputfn , params ):
103107
104- response = self .get_response (action , params , "GET" );
108+ response = self ._get_response (action , params , "GET" );
105109
106110 if (response .status != 200 ):
107111 return False
@@ -190,13 +194,12 @@ def get_client_status(self, clientname):
190194 logger .warning ("Could not find client status. No permission?" )
191195 return None
192196
193- def download_installer (self , installer_fn , new_clientname ):
197+ def download_installer (self , installer_fn , new_clientname , e_installer_os ):
194198
195199 if not self .login ():
196200 return False
197-
198- new_client = self ._get_json ("add_client" , { "clientname" : new_clientname })
199-
201+
202+ new_client = self ._get_json ("add_client" , { "clientname" : new_clientname })
200203 if "already_exists" in new_client :
201204
202205 status = self .get_client_status (new_clientname )
@@ -205,15 +208,17 @@ def download_installer(self, installer_fn, new_clientname):
205208 return False
206209
207210 return self ._download_file ("download_client" , installer_fn ,
208- {"clientid" : status ["id" ] })
211+ {"clientid" : status ["id" ],
212+ "os" : e_installer_os .value })
209213
210214
211215 if not "new_authkey" in new_client :
212216 return False
213217
214218 return self ._download_file ("download_client" , installer_fn ,
215219 {"clientid" : new_client ["new_clientid" ],
216- "authkey" : new_client ["new_authkey" ]
220+ "authkey" : new_client ["new_authkey" ],
221+ "os" : e_installer_os .value
217222 })
218223
219224 def add_client (self , clientname ):
0 commit comments