@@ -35,7 +35,7 @@ def open_uftp_session(self, host, port, password):
3535 self .ftp .connect (host , port )
3636 self .ftp .login ("anonymous" , password )
3737
38- def authenticate (self , security , base_url , base_dir = "" ):
38+ def authenticate (self , security , base_url , base_dir = "" , preferences = None , persistent = True ):
3939 """authenticate to the auth server and return a tuple (host, port, one-time-password)"""
4040 if isinstance (security , Credential ):
4141 transport = Transport (security )
@@ -45,10 +45,13 @@ def authenticate(self, security, base_url, base_dir=""):
4545 raise TypeError ("Need Credential or Transport object" )
4646 if base_dir != "" and not base_dir .endswith ("/" ):
4747 base_dir += "/"
48+ if preferences is not None :
49+ transport .preferences = preferences
4850 req = {
49- "persistent" : "true" ,
5051 "serverPath" : base_dir + self .uftp_session_tag ,
5152 }
53+ if persistent :
54+ req ["persistent" ] = "true"
5255 params = transport .post (url = base_url , json = req ).json ()
5356 return params ["serverHost" ], params ["serverPort" ], params ["secret" ]
5457
0 commit comments