Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
python中的多响应解析_Python_Linux_Hadoop_Curl_Webhdfs - Fatal编程技术网

python中的多响应解析

python中的多响应解析,python,linux,hadoop,curl,webhdfs,Python,Linux,Hadoop,Curl,Webhdfs,我使用curl命令访问hadoop(webhdfs),对于http响应解析,我使用python 但在触发curl命令后,将返回多个响应 curl -i "http://host:50070/webhdfs/v1/user/hduser/pigtest?op=GETFILESTATUS" HTTP/1.1 401 Authentication required Cache-Control: no-cache Expires: Thu, 14 Jan 2016 10:04:23 GMT Date

我使用curl命令访问hadoop(webhdfs),对于http响应解析,我使用python

但在触发curl命令后,将返回多个响应

curl -i  "http://host:50070/webhdfs/v1/user/hduser/pigtest?op=GETFILESTATUS"

HTTP/1.1 401 Authentication required
Cache-Control: no-cache
Expires: Thu, 14 Jan 2016 10:04:23 GMT
Date: Thu, 14 Jan 2016 10:04:23 GMT
Pragma: no-cache
Expires: Thu, 14 Jan 2016 10:04:23 GMT
Date: Thu, 14 Jan 2016 10:04:23 GMT
Pragma: no-cache
Content-Type: plain/text
Transfer-Encoding: chunked
Server: Jetty(6.1.26.hwx)

HTTP/1.1 200 OK
Cache-Control: no-cache
Expires: Thu, 14 Jan 2016 10:04:23 GMT
Date: Thu, 14 Jan 2016 10:04:23 GMT
Pragma: no-cache
Expires: Thu, 14 Jan 2016 10:04:23 GMT
Date: Thu, 14 Jan 2016 10:04:23 GMT
Pragma: no-cache
Content-Type: application/json
Transfer-Encoding: chunked
Server: Jetty(6.1.26.hwx)

{"FileStatus":{"accessTime":1452062206193,"blockSize":134217728,"childrenNum":0,"fileId":39295,"group":"hdfs","length":753,"modificationTime":1452062206392,"owner":"hduser","pathSuffix":"","permission":"644","replication":2,"storagePolicy":0,"type":"FILE"}} 
如何在python中解析这些多个响应


谢谢

您能告诉我们如何将响应输入Python吗?这是一个不符合HTTP的中断响应。@Saksow:目前我使用上面的字符串响应来解析它。我引用这个链接只是为了提供更多信息,我使用--congotiate-u:选项和curl,因为我有一个支持kerberos的集群。