def Auth(self, isopen=True): self.transport = THttpClient.THttpClient(self.host) self.transport.setCustomHeaders(self.headers) self.protocol = TCompactProtocol.TCompactProtocol(self.transport) self._auth = AuthService.Client(self.protocol) if isopen: self.transport.open() return self._auth
def Auth(self, isopen=True): auth_transport = THttpClient(self.host, customThrift=self.customThrift) auth_transport.setCustomHeaders(self.headers) auth_protocol = TCompactProtocol.TCompactProtocol(auth_transport) _auth = AuthService.Client(auth_protocol) if isopen: auth_transport.open() return _auth
def getToken(self, mid): headers = {'X-Line-Application': 'IOSIPAD 7.14.0 iPhone OS 10.12.0'} transport = THttpClient.THttpClient( 'https://gfs.line.naver.jp/api/v4/TalkService.do') transport.setCustomHeaders(headers) protocol = TCompactProtocol.TCompactProtocol(transport) _talk = TalkService.Client(protocol) transport.open() qrCode = _talk.getAuthQrcode(keepLoggedIn=True, systemName=None) self.talk.sendMessage(mid, "line://au/q/" + qrCode.verifier) self.server.setHeaders('X-Line-Acces', qrCode.verifier) getAccessKey = self.server.getJson('https://gfs.line.naver.jp/Q', allowHeader=True) transport = THttpClient.THttpClient( 'https://gfs.line.naver.jp/api/v4p/rs') transport.setCustomHeaders(headers) protocol = TCompactProtocol.TCompactProtocol(transport) _auth = AuthService.Client(protocol) transport.open() try: Ieq = Auth.loginRequests( '1', { 'keepLoggedIn': True, 'systemName': None, 'identityProvider': IdentityProvider.LINE, 'verifier': getAccessKey['result']['verifier'], 'accessLocation': ("8.8.8.8"), 'e2eeVersion': 0 }) result = _auth.loginZ(IReq) except Exception as e: raise Exception(e) if result.type == LoginResultType.Success: if result.authToken is not None: self.talk.sendMessage(mid, result.authToken)