使用Python解析POST HTTP响应
我想使用python解析POST HTTP响应 我的回答是:使用Python解析POST HTTP响应,python,parsing,httprequest,httpresponse,Python,Parsing,Httprequest,Httpresponse,我想使用python解析POST HTTP响应 我的回答是: { "Result": 0, "ResponseStatus": { "ErrorCode": null, "Message": null, "StackTrace": null, "Errors": null }, "SessionId": "68ebcd6f-0aef-420d-a12b-c953f8df8ed1", "ResponseHeader": { "Succee
{
"Result": 0,
"ResponseStatus": {
"ErrorCode": null,
"Message": null,
"StackTrace": null,
"Errors": null
},
"SessionId": "68ebcd6f-0aef-420d-a12b-c953f8df8ed1",
"ResponseHeader": {
"Succeeded": true,
"Errors": []
}
}
我想将“SessionID”解析为第二个http请求。
我怎样才能做到呢?谢谢
import json
response = '{"Result": 0, "ResponseStatus": { "ErrorCode": null,"Message": null, "StackTrace": null, "Errors": null },"SessionId": "68ebcd6f-0aef-420d-a12b-c953f8df8ed1", "ResponseHeader": { "Succeeded": true, "Errors": [] } }'
json_response = json.loads(response)
print json_response['SessionId']
我猜您正在使用urllib,我建议您使用
我猜您使用的是urllib,我建议使用使用json模块。请添加用于检索该模块的代码,以便我们可以根据它提供帮助。谢谢使用json模块。请添加用于检索该模块的代码,以便我们可以在此基础上提供帮助。谢谢谢谢我是python新手。如果您能帮我写两个http请求,第二个请求基于第一个请求的SessionId,我将不胜感激。谢谢!我是python新手。如果您能帮助我编写两个http请求,第二个请求基于第一个请求的SessionId,我将不胜感激