itschasa/Discord-Backup

JSON Decode Error on Requests

scottjsh opened this issue · 14 comments

When I put token, this error occur.
I put verified token.

Manual input

Traceback (most recent call last):
  File "C:\Users\odont\AppData\Roaming\Python\Python310\site-packages\requests\models.py", line 910, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Program Files\Python310\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Program Files\Python310\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Program Files\Python310\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\~~백업~~\Discord-Account-Backup\main.py", line 91, in <module>
    bkup = backup.backup(token_info[0], c)
  File "D:\~~백업~~\Discord-Account-Backup\backup.py", line 20, in __init__
    self.user_me = token_check.json()
  File "C:\Users\odont\AppData\Roaming\Python\Python310\site-packages\requests\models.py", line 917, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError

Auto scan

Traceback (most recent call last):
  File "C:\Users\odont\AppData\Roaming\Python\Python310\site-packages\requests\models.py", line 910, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Program Files\Python310\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Program Files\Python310\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Program Files\Python310\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\~~백업~~\Discord-Backup-main\main.py", line 69, in <module>
    tokens = fetch_tokens.fetch()
  File "D:\~~백업~~\Discord-Backup-main\fetch_tokens.py", line 109, in fetch
    tknid = r.json()["id"]
  File "C:\Users\odont\AppData\Roaming\Python\Python310\site-packages\requests\models.py", line 917, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError

I found solution

ALL CHANGE

headers=self._headers("get", debugoptions=True, discordlocale=True, superprop=True, authorization=True)

TO

headers={"Authorization": self.token}

that makes the requests unsafe, as they don't have the appropriate headers

i'll find a fix soon

@scottjsh i think i found a fix, can you run the following to install brotil?

pip install brotli

I found solution

ALL CHANGE

headers=self._headers("get", debugoptions=True, discordlocale=True, superprop=True, authorization=True)

TO

headers={"Authorization": self.token}

This works perfectly.
No needs to fix.
Thx for reply

I found solution
ALL CHANGE

headers=self._headers("get", debugoptions=True, discordlocale=True, superprop=True, authorization=True)

TO

headers={"Authorization": self.token}

This works perfectly. No needs to fix. Thx for reply

what im saying is that you changing the headers makes it likely that your account could get termed if discord starts to detect it

@scottjsh i think i found a fix, can you run the following to install brotil?

pip install brotli

Ok this working Thx!

Edit brotil to brotli in requirements.txt

skill

i face the same issue | autoscan

Traceback (most recent call last):
  File "main.py", line 69, in <module>
    tokens = fetch_tokens.fetch()
  File "C:\Users\____\Discord-Backup\fetch_tokens.py", line 109, in fetch
    tknid = r.json()["id"]
  File "C:\Users\______\AppData\Local\Programs\Python\Python38\lib\site-packages\requests\models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\______\AppData\Local\Programs\Python\Python38\lib\json\__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "C:\Users\_______\AppData\Local\Programs\Python\Python38\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\______\AppData\Local\Programs\Python\Python38\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)```

even after i did 'pip install brotli'

i'll work on a more stable solution soon

alright, thanks a lot

should be fixed now