telegraph icon indicating copy to clipboard operation
telegraph copied to clipboard

JSONDecodeError when edit page

Open Soulbadguy54 opened this issue 3 years ago • 1 comments

Get error when simply try to edit page.

File "C:\Users\Soulbadguy\PycharmProjects\match_parsers\objects\telegraph.py", line 80, in _act_telegraph
  page = await func(**func_args)
File "C:\Users\Soulbadguy\PycharmProjects\match_parsers\.venv\lib\site-packages\telegraph\aio.py", line 209, in edit_page
  return (await self._telegraph.method('editPage', path=path, values={
File "C:\Users\Soulbadguy\PycharmProjects\match_parsers\.venv\lib\site-packages\telegraph\aio.py", line 32, in method
  response = (await self.session.post(
File "C:\Users\Soulbadguy\PycharmProjects\match_parsers\.venv\lib\site-packages\httpx\_models.py", line 742, in json
  return jsonlib.loads(self.content.decode(encoding), **kwargs)
File "C:\Users\Soulbadguy\AppData\Local\Programs\Python\Python39\lib\json\__init__.py", line 346, in loads
  return _default_decoder.decode(s)
File "C:\Users\Soulbadguy\AppData\Local\Programs\Python\Python39\lib\json\decoder.py", line 337, in decode
  obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\Soulbadguy\AppData\Local\Programs\Python\Python39\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)

The args are right, the hltm content dont have any unclosed tags, but simply get this error...

The funniest thing consists in the fix for this problem. Just rerun and rerun the request without any changes. And at 5th or 6th try (ususally) the problem is fixed...

When i dont get error, i obviously get response.status 200 and json object as response. But sometimes i get 500 status with that NOT JSON body, that raise the exeption:

<html>
<head><title>500 Internal Server Error</title></head>
<body>
<center><h1>500 Internal Server Error</h1></center>
<hr><center>nginx/1.20.1</center>
</body>
</html>

Soulbadguy54 avatar Nov 06 '22 07:11 Soulbadguy54

10.02.2023 i receive 500 error all day Did you find the solution? @Soulbadguy54

ssuprun89 avatar Feb 09 '23 22:02 ssuprun89