Skip to content

Commit

Permalink
Added token_expire parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
olokelo committed Jan 10, 2021
1 parent 6981fcd commit dec7e9c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pcloud/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ class PyCloud(object):

endpoint = "https://api.pcloud.com/"

def __init__(self, username, password):
def __init__(self, username, password, token_expire=31536000):
self.username = username.lower().encode("utf-8")
self.password = password.encode("utf-8")
self.token_expire = token_expire
self.session = requests.Session()
self.auth_token = self.get_auth_token()

Expand Down Expand Up @@ -76,6 +77,7 @@ def get_auth_token(self):
"username": self.username.decode("utf-8"),
"digest": digest.decode("utf-8"),
"passworddigest": passworddigest.hexdigest(),
"authexpire": self.token_expire,
}
resp = self._do_request("userinfo", authenticate=False, **params)
if "auth" not in resp:
Expand Down

0 comments on commit dec7e9c

Please sign in to comment.