MCPcopy Create free account
hub / github.com/UndCover/PyramidStore / login

Method login

plugin/py_ali.py:393–419  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

391 self.listFiles(map,shareId,shareToken,item)
392
393 def login(self):
394 self.localTime = int(time.time())
395 url = 'https://api.aliyundrive.com/token/refresh'
396 if len(self.authorization) == 0 or self.timeoutTick - self.localTime <= 600:
397 form = {
398 'refresh_token':'4acb3ad2f2254ba1b566279f7cd98ba3'
399 }
400 try:
401 if len(self.extend) > 0:
402 form['refresh_token'] = self.extend
403 except Exception as e:
404 pass
405 rsp = requests.post(url,json = form,headers=self.header)
406 jo = json.loads(rsp.text)
407 if rsp.status_code == 200:
408 self.authorization = jo['token_type'] + ' ' + jo['access_token']
409 self.expiresIn = int(jo['expires_in'])
410 self.timeoutTick = self.localTime + self.expiresIn
411 return True
412 return False
413 else:
414 return True
415
416 # print(self.authorization)
417 # print(self.timeoutTick)
418 # print(self.localTime)
419 # print(self.expiresIn)

Callers 3

fhdContentMethod · 0.95
originContentMethod · 0.95
localProxyMethod · 0.95

Calls 1

postMethod · 0.45

Tested by

no test coverage detected