Esempio n. 1
0
 def Liff(self, isopen=True):
     self.transport = THttpClient.THttpClient(self.host)
     self.transport.setCustomHeaders(self.headers)
     self.protocol = TCompactProtocol.TCompactProtocol(self.transport)
     self._liff = TalkService.Client(self.protocol)
     if isopen:
         self.transport.open()
     return self._liff
Esempio n. 2
0
 def __init__(self, authToken):
   Config.__init__(self)
   self.transport = THttpClient.THttpClient(self.LINE_HOST_DOMAIN, None, self.LINE_API_QUERY_PATH_FIR)
   self.transport.path = self.LINE_AUTH_QUERY_PATH
   self.transport.setCustomHeaders({"X-Line-Application" : self.APP_NAME,"User-Agent" : self.USER_AGENT,"X-Line-Access": authToken})
   self.protocol = TCompactProtocol.TCompactProtocol(self.transport);
   self.client = TalkService.Client(self.protocol)
   self.rev = self.client.getLastOpRevision()
   self.transport.path = self.LINE_POLL_QUERY_PATH_FIR
   self.transport.open()
Esempio n. 3
0
    def Talk(self, isopen=True):
        talk_transport = THttpClient(self.host, customThrift=self.customThrift)
        talk_transport.setCustomHeaders(self.headers)
        talk_protocol = TCompactProtocol.TCompactProtocol(talk_transport)
        _talk  = TalkService.Client(talk_protocol)

        if isopen:
            talk_transport.open()

        return _talk
Esempio n. 4
0
 def __init__(self):
     Config.__init__(self)
     self.transport = THttpClient.THttpClient(self.LINE_HOST_DOMAIN, None,
                                              self.LINE_API_QUERY_PATH_FIR)
     self.transport.setCustomHeaders({
         "X-Line-Application": self.APP_NAME,
         "User-Agent": self.APP_NAME
     })
     self.transport.open()
     self.protocol = TCompactProtocol.TCompactProtocol(self.transport)
     self.client = TalkService.Client(self.protocol)
Esempio n. 5
0
    def Talk(self, isopen=True):
        self.transport = THttpClient(self.host, customThrift=self.customThrift)
        #        self.transport = THttpClient.THttpClient(self.host)
        self.transport.setCustomHeaders(self.headers)

        self.protocol = TCompactProtocol.TCompactProtocol(self.transport)
        self._talk = TalkService.Client(self.protocol)

        if isopen:
            self.transport.open()

        return self._talk
Esempio n. 6
0
    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)