JSONDecodeError when trying to logging with username and password
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- python
- 领域
- api, authentication
调研方向
首先复现 matrix_client/client.py 中的 login 调用,并跟踪 matrix_client/api.py 中的请求处理,尤其是 _send 和 login。在 JSON 解析之前检查服务器响应,并将其与预期的 login 响应进行比较;确认空响应或非 JSON 响应的原因并记录已确认的修复后,即视为完成。
由索引模型根据 Issue 内容生成。
描述
Hi there!
I'm currently trying to use Matrix to log in a server webpage with username and password. I'm using Python 3 and the appropriate SDK, but I'm facing an issue: Since it looks that I succeed in reaching the server page address, an error occurs when it comes to logging in:
Traceback (most recent call last):
File "test.py", line 12, in <module>
token = client.login(username="***", password="***", limit=10, sync=True, device_id=None)
File "/usr/local/lib/python3.6/dist-packages/matrix_client-0.4.0.dev0-py3.6.egg/matrix_client/client.py", line 278, in login
File "/usr/local/lib/python3.6/dist-packages/matrix_client-0.4.0.dev0-py3.6.egg/matrix_client/api.py", line 181, in login
File "/usr/local/lib/python3.6/dist-packages/matrix_client-0.4.0.dev0-py3.6.egg/matrix_client/api.py", line 761, in _send
File "/home/user/.local/lib/python3.6/site-packages/requests/models.py", line 897, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
My code is really basic:
#!/usr/bin/env python3
from matrix_client.client import MatrixClient
client = MatrixClient("webpage_logging_address")
token = client.login(username="***", password="***", limit=10, sync=True, device_id=None)
I've been searching for a solution for hours, without success. Any idea of why this happens and how to solve the problem?
Thanks a lot,
MyDev
- 主要语言
- Python
- 星标
- 266
- 派生
- 118
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
matrix-org/matrix-python-sdk 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 25/100
matrix-org/matrix-python-sdk#330 · 3 个 reaction ·
-
难度 5/5 一周以上 新手友好度 25/100
matrix-org/matrix-python-sdk#326 ·
-
难度 1/5 1 小时以内 新手友好度 55/100
matrix-org/matrix-python-sdk#324 ·
-
难度 2/5 1-3 小时 新手友好度 48/100
matrix-org/matrix-python-sdk#323 ·
-
难度 3/5 1-2 天 新手友好度 35/100
matrix-org/matrix-python-sdk#319 ·
查看 matrix-org/matrix-python-sdk 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
stephrobert/dsoxlab#238 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
sublimehq/package_control#1780 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
-
难度 2/5 1-3 小时 新手友好度 70/100
nwg-piotr/nwg-displays#145 ·