Skip to content

Commit 667db0d

Browse files
committed
fix: add 'preferences' and 'persistent' options to UFTP.authenticate() function
1 parent 50b425a commit 667db0d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ Changelog for PyUNICORE
33

44
Issue tracker: https://github.com/HumanBrainProject/pyunicore
55

6+
Version 1.3.2 (May 15, 2025)
7+
----------------------------
8+
- fix: add "preferences" and "persistent" options to the
9+
UFTP.autheticate() function
10+
611

712
Version 1.3.1 (May 15, 2025)
813
----------------------------

pyunicore/uftp/uftp.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)