我正在尝试通过pythonscirpt获取JSON和打印。我收到服务器200的回复,不知道为什么我不能打印文件。请帮帮我!!你知道吗
使用的代码是:
Import Requests
response = requests.get("https://Site1/rest/settings/all-server-status", params={'serverId': '56cd7e4d2d0edcace915e674'}, verify=False)
json_data = json.loads(response.text)
我得到以下错误:
Traceback (most recent call last):
File "<pyshell#51>", line 1, in <module>
json_data = json.loads(response.text)
File "C:\Python27\lib\json\__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "C:\Python27\lib\json\decoder.py", line 366, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Python27\lib\json\decoder.py", line 384, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
我也尝试了以下陈述,但没有回应:
json_data = json.loads(response)
json_data = json.loads(response.read())
Json示例输出应为:
[{"id":"56cd7e4d2d0edcace915e674","protocol":"https","hostName":"x.x.x.x","port":443,"serverName":"Site1","status":"connected","connected":true}]
提前谢谢!你知道吗
您发出的POST请求没有返回任何内容,但是
Response 200
表示连接成功(没有SSL错误等)。你知道吗问题就在这里:
params={'serverId': '56cd7e4d2d0edcace915e674'}
。你知道吗我建议调试你的
request.get()
。你知道吗首先检查
https://hostname.com/key=value
是否有效。你知道吗相关问题 更多 >
编程相关推荐