This repository has been archived by the owner on Dec 19, 2023. It is now read-only.
修改urls["is_json"] 为true时,response非json格式bug,导致异常退出,使得用户一直 登陆不上bug。 #695
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
比如打印response content内容: b'halo, world\n'
Traceback (most recent call last):
File "run.py", line 22, in
select_ticket_info.select().main()
File "/Users/sun/Documents/workspace/python/12306/init/select_ticket_info.py", line 123, in main
self.call_login()
File "/Users/sun/Documents/workspace/python/12306/init/select_ticket_info.py", line 117, in call_login
self.login.go_login()
File "/Users/sun/Documents/workspace/python/12306/init/login.py", line 129, in go_login
uamtk = self.baseLogin(user, passwd)
File "/Users/sun/Documents/workspace/python/12306/init/login.py", line 66, in baseLogin
tresult = self.session.httpClint.send(logurl, loginData)
File "/Users/sun/Documents/workspace/python/12306/myUrllib/httpUtils.py", line 187, in send
response.content.decode() if isinstance(response.content, bytes) else response.content)
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/init.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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)