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

Method login

plugin/py_ali_subtitle.py:424–450  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

422 break
423
424 def login(self):
425 self.localTime = int(time.time())
426 url = 'https://api.aliyundrive.com/token/refresh'
427 if len(self.authorization) == 0 or self.timeoutTick - self.localTime <= 600:
428 form = {
429 'refresh_token':'4acb3ad2f2254ba1b566279f7cd98ba3'
430 }
431 try:
432 if len(self.extend) > 0:
433 form['refresh_token'] = self.extend
434 except Exception as e:
435 pass
436 rsp = requests.post(url,json = form,headers=self.header)
437 jo = json.loads(rsp.text)
438 if rsp.status_code == 200:
439 self.authorization = jo['token_type'] + ' ' + jo['access_token']
440 self.expiresIn = int(jo['expires_in'])
441 self.timeoutTick = self.localTime + self.expiresIn
442 return True
443 return False
444 else:
445 return True
446
447 # print(self.authorization)
448 # print(self.timeoutTick)
449 # print(self.localTime)
450 # 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