Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSONDecodeError when edit page #47

Open
Soulbadguy54 opened this issue Nov 6, 2022 · 1 comment
Open

JSONDecodeError when edit page #47

Soulbadguy54 opened this issue Nov 6, 2022 · 1 comment

Comments

@Soulbadguy54
Copy link

Soulbadguy54 commented Nov 6, 2022

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>
@ssuprun89
Copy link

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

Sasivarnasarma added a commit to Sasivarnasarma/telegraph that referenced this issue Apr 5, 2024
Issues python273#56 , python273#55 , python273#47 Fixed.
Added New Exception.
 __init__ file improved.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants