louisabraham / har2requests

Generate Python Requests code from your browser activity 🤖
MIT License
99 stars 15 forks source link

Strange JSON decoding problem at 1MB mark on line #21

Open stucka opened 1 month ago

stucka commented 1 month ago

I'm using Python 3.10.6 on Windows and am getting a strange little JSON decoding problem that's curiously right at the 1mb mark, so I'm inclined to think there's a character limitation somewhere.

Traceback (most recent call last):
  File "C:\Python\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Python\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Python\Scripts\har2requests.exe\__main__.py", line 7, in <module>
  File "C:\Python\lib\site-packages\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "C:\Python\lib\site-packages\click\core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "C:\Python\lib\site-packages\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Python\lib\site-packages\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "C:\Python\lib\site-packages\har2requests\__init__.py", line 136, in main
    request = Request.from_json(
  File "C:\Python\lib\site-packages\har2requests\request.py", line 69, in from_json
    responseData = json.loads(responseText)
  File "C:\Python\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Python\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Python\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 1048575 (char 1048574)

Looks like farther down Firefox broke the export, too:

{\"Value\":false,\"CanBeChanged\":tru"
          },
louisabraham commented 1 month ago

Hello!

What do you mean by "Firefox broke the export"?

Do you have a way to look at the JSON that Python is trying to decode?

I don't think Python has trouble with long JSON, so it's probably the data we are putting in that is corrupted.