Skip to content

Commit 4f8c4f3

Browse files
author
felix
committed
added option to limit the token lifetime.
1 parent 1ebe67b commit 4f8c4f3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

publications/2023-neurips/lcdb/db/_pcloud_repository.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,16 @@ def update_content(self):
3131
def exists(self):
3232
return self.content is not None and len(self.content) > 0
3333

34-
def authenticate(self, username, password):
35-
url = f"https://api.pcloud.com/userinfo?getauth=1&logout=1&device=lcdbclient"
34+
def authenticate(self, username, password, device="lcdbclient", authexpire=300):
35+
"""
36+
37+
:param username: the username at pCloud with access to this repository
38+
:param password: the password of the user
39+
:param device: name associated with the authentication request (usually no change reasonable)
40+
:param authexpire: time in seconds after which the received token will expire
41+
:return:
42+
"""
43+
url = f"https://api.pcloud.com/userinfo?getauth=1&logout=1&device={device}&authexpire={authexpire}"
3644
response = requests.post(url, {
3745
"username": username,
3846
"password": password

0 commit comments

Comments
 (0)