LINE icon indicating copy to clipboard operation
LINE copied to clipboard

No JSON object could be decoded! help!

Open chungsir opened this issue 7 years ago • 17 comments

File "C:\Python27\lib\json\decoder.py", line 382, in raw_decode raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded

chungsir avatar Feb 16 '17 07:02 chungsir

self._headers['X-Line-Application'] cause LINE server response empty when call to http://gd2.line.naver.jp/authct/v1/keys/line.

max32002 avatar Feb 17 '17 03:02 max32002

now can't login in to get lineclient how to modify it thanks very much

chungsir avatar Feb 17 '17 11:02 chungsir

Also having this issue, was anyone able to find a solution?

seltun avatar Feb 21 '17 18:02 seltun

in the def login(self): in api.py self._headers['X-Line-Application']=app self.transport.setCustomHeaders(self._headers)

shinomura: now I can login and get authtoken

1.disable header "X-Line-Application" before get json 2.add it back after that then change LINE_DOMAIN from http to https

max32002 avatar Mar 05 '17 18:03 max32002

Hi max32002, I have any question, could you please help to confirm.

1.disable header "X-Line-Application" before get json Question#1: Above header for disable that is it mean to mark or remove only line as "self._headers['X-Line-Application']=app" in api.py , right?

Question#2: If correct, the next step after disable header - Is it compile bot line code as once time before implement activity 2.,right?

2.add it back after that then change LINE_DOMAIN from http to https Question#3: The next step is adding the header of 'self._headers['X-Line-Application']=app' and change to https. And then compile bot line code again, right?

Thank you very much

Ploiiz avatar Mar 14 '17 09:03 Ploiiz

in api.py, change http to https:

class LineAPI(object):
    """This class is a wrapper of LINE API

    """
    LINE_DOMAIN = "https://gd2.line.naver.jp"


    def login(self):
        """Login to LINE server."""
        if self.provider == CurveThrift.Provider.LINE: # LINE
            j = self._get_json(self.LINE_SESSION_LINE_URL)
        else: # NAVER
            j = self._get_json(self.LINE_SESSION_NAVER_URL)

        session_key = j['session_key']
        message     = (chr(len(session_key)) + session_key +
                       chr(len(self.id)) + self.id +
                       chr(len(self.password)) + self.password).encode('utf-8')

        keyname, n, e = j['rsa_key'].split(",")
        pub_key       = rsa.PublicKey(int(n,16), int(e,16))
        crypto        = rsa.encrypt(message, pub_key).encode('hex')

        self.transport = THttpClient.THttpClient(self.LINE_HTTP_URL)
        os_version = "10.9.4-MAVERICKS-x64"
        app = "DESKTOPMAC\t%s\tMAC\t%s" % (self.version, os_version)
        self._headers['X-Line-Application']=app

max32002 avatar Mar 15 '17 10:03 max32002

I've done that but I get this TypeError: 'unicode' does not have the buffer interface

brendhadhea avatar Apr 15 '17 05:04 brendhadhea

use thrift v0.9.3 refrence @brendhadhea #98

ii64 avatar Apr 15 '17 13:04 ii64

Hi Max,

Today, I change LINE_DOMAIN to "https://gd2.line.naver.jp" that I can login successful. But I can send only text message. Then, image message was failed to send. I receive an error "Send image fail Line group is not exist" although I send text message to the same group. Cloud you please help to advise. Thank you very much

[2017-05-11 18:46:52.832244] [[email protected]] [Initial] Start login line client [2017-05-11 18:46:57.620598] [[email protected]] [Initial] Login Success [2017-05-11 18:46:57.620689] [Login] [[email protected]] - AuthToken=Egvn8eLkB8vEA64yilpf.UzPg4X6oF73wMIC8vfve3W.RTBbJyGkfrw+oOM6/Q7DDp78e4Pqf+D7ImwCoqBu33k= [2017-05-11 18:46:57.624577] [[email protected]] [Initial] Establish socket listener on port 8090 [2017-05-11 18:47:37.690681] [[email protected]] [Socket] [ip:port] Send text success - Group(Tester) : pp [2017-05-11 18:47:59.835257] [[email protected]] [Socket] [ip:port] Send image fail Line group is not exist - Group(Tester) : Size 27087 bytes

2017-03-15 17:32 GMT+07:00 Max [email protected]:

in api.py, change http to https:

class LineAPI(object): """This class is a wrapper of LINE API

"""
LINE_DOMAIN = "https://gd2.line.naver.jp"

def login(self):
    """Login to LINE server."""
    if self.provider == CurveThrift.Provider.LINE: # LINE
        j = self._get_json(self.LINE_SESSION_LINE_URL)
    else: # NAVER
        j = self._get_json(self.LINE_SESSION_NAVER_URL)

    session_key = j['session_key']
    message     = (chr(len(session_key)) + session_key +
                   chr(len(self.id)) + self.id +
                   chr(len(self.password)) + self.password).encode('utf-8')

    keyname, n, e = j['rsa_key'].split(",")
    pub_key       = rsa.PublicKey(int(n,16), int(e,16))
    crypto        = rsa.encrypt(message, pub_key).encode('hex')

    self.transport = THttpClient.THttpClient(self.LINE_HTTP_URL)
    os_version = "10.9.4-MAVERICKS-x64"
    app = "DESKTOPMAC\t%s\tMAC\t%s" % (self.version, os_version)
    self._headers['X-Line-Application']=app

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/carpedm20/LINE/issues/92#issuecomment-286702703, or mute the thread https://github.com/notifications/unsubscribe-auth/AZLptE3EV2A4jU7QeGc-jSsB5qwYJPYMks5rl75RgaJpZM4MCr_n .

Ploiiz avatar May 11 '17 12:05 Ploiiz

Resolved in #93

Nilpo avatar May 24 '17 09:05 Nilpo

`Traceback (most recent call last): File "", line 1, in File "line/client.py", line 93, in init self.login() File "line/api.py", line 158, in login

File "/usr/local/lib/python2.7/dist-packages/curve/CurveThrift.py", line 343, in loginWithIdentityCredentialForCertificate self.send_loginWithIdentityCredentialForCertificate(identifier, password, keyname, crypto, keepLoggedIn, accessLocation, systemName, identityProvider, certificate) File "/usr/local/lib/python2.7/dist-packages/curve/CurveThrift.py", line 358, in send_loginWithIdentityCredentialForCertificate args.write(self._oprot) File "/usr/local/lib/python2.7/dist-packages/curve/CurveThrift.py", line 2416, in write oprot.writeString(self.keyname) File "/usr/local/lib/python2.7/dist-packages/thrift/protocol/TProtocol.py", line 121, in writeString self.writeBinary(str_to_binary(str_val)) File "/usr/local/lib/python2.7/dist-packages/thrift/protocol/TCompactProtocol.py", line 42, in nested return func(self, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/thrift/protocol/TCompactProtocol.py", line 272, in __writeBinary self.trans.write(s) File "/usr/local/lib/python2.7/dist-packages/thrift/transport/THttpClient.py", line 134, in write self.__wbuf.write(buf) TypeError: 'unicode' does not have the buffer interface`

i try , like this, who's can solved it ?

anoaghost avatar May 25 '17 05:05 anoaghost

Please read the comment before you. This is resolved in #93

Nilpo avatar May 25 '17 07:05 Nilpo

wqe

please help me!

RichoDS avatar May 30 '17 17:05 RichoDS

Please read the comments.

Nilpo avatar May 30 '17 19:05 Nilpo

Hi' Max,

I have some problem today. I found an error as following:-

[2017-08-01 16:33:41.259085] [Login] [AM-[Official]] - Start login line client [2017-08-01 16:33:42.054822] [Login] [AM-[Official]] - Login Fail [2017-08-01 16:33:42.054933] [Error exception in main thread] TalkException(parameterMap=None, reason='Internal error', code=20)

How I can resolve about 'Internal error'?

Thank you so much.

2017-03-15 17:32 GMT+07:00 Max [email protected]:

in api.py, change http to https:

class LineAPI(object): """This class is a wrapper of LINE API

"""
LINE_DOMAIN = "https://gd2.line.naver.jp"

def login(self):
    """Login to LINE server."""
    if self.provider == CurveThrift.Provider.LINE: # LINE
        j = self._get_json(self.LINE_SESSION_LINE_URL)
    else: # NAVER
        j = self._get_json(self.LINE_SESSION_NAVER_URL)

    session_key = j['session_key']
    message     = (chr(len(session_key)) + session_key +
                   chr(len(self.id)) + self.id +
                   chr(len(self.password)) + self.password).encode('utf-8')

    keyname, n, e = j['rsa_key'].split(",")
    pub_key       = rsa.PublicKey(int(n,16), int(e,16))
    crypto        = rsa.encrypt(message, pub_key).encode('hex')

    self.transport = THttpClient.THttpClient(self.LINE_HTTP_URL)
    os_version = "10.9.4-MAVERICKS-x64"
    app = "DESKTOPMAC\t%s\tMAC\t%s" % (self.version, os_version)
    self._headers['X-Line-Application']=app

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/carpedm20/LINE/issues/92#issuecomment-286702703, or mute the thread https://github.com/notifications/unsubscribe-auth/AZLptE3EV2A4jU7QeGc-jSsB5qwYJPYMks5rl75RgaJpZM4MCr_n .

Ploiiz avatar Aug 01 '17 10:08 Ploiiz

@Ploiiz Line updated something so it doesn't work #131

R-N avatar Aug 02 '17 11:08 R-N

Oh, If you have solution for resole that, could you please help to inform me. Thank you.

2017-08-02 18:55 GMT+07:00 Muhammad Rizqi Nur [email protected]:

@Ploiiz https://github.com/ploiiz Line updated something so it doesn't work #131 https://github.com/carpedm20/LINE/issues/131

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/carpedm20/LINE/issues/92#issuecomment-319650592, or mute the thread https://github.com/notifications/unsubscribe-auth/AZLptKyprm0dZm0dYEp9xtmDl0PxTnfOks5sUGOUgaJpZM4MCr_n .

Ploiiz avatar Aug 04 '17 03:08 Ploiiz