Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/19.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请求获得正确的响应';post方法_Python_Python 3.x_Http_Python Requests - Fatal编程技术网

无法使用python请求获得正确的响应';post方法

无法使用python请求获得正确的响应';post方法,python,python-3.x,http,python-requests,Python,Python 3.x,Http,Python Requests,我正在尝试自动恢复数据(我想要的是“ BVBG.086.01价格报告”)。通过查看firefox,我发现发布到的请求URL为“”,参数为: hdnStatus: "ativo" chkArquivoDownload_ativo "28" txtDataDownload_ativo "09/02/2018" imgSubmeter "Download" txtDataDownload_externo_ativo [3] 0 "25/08/2017" 1 "25

我正在尝试自动恢复数据(我想要的是“ BVBG.086.01价格报告”)。通过查看firefox,我发现发布到的请求URL为“”,参数为:

hdnStatus: "ativo"
chkArquivoDownload_ativo    "28"
txtDataDownload_ativo   "09/02/2018"
imgSubmeter "Download"
txtDataDownload_externo_ativo   [3]
    0   "25/08/2017"
    1   "25/08/2017"
    2   "25/08/2017"
因此,如果我使用hurl.it发出请求,则响应是正确的302重定向(指向请求文件所在的FTP URL,类似于“Location:/FTP/Temp/10981738/Download.ex”)。()

因此,我尝试对以下代码执行相同的操作(使用python的库“requests”,我尝试了request_body的两个版本,试图将其放入post方法的“data”参数中)

我得到的回应如下:

<html><head><title>Object moved</title></head>
<body><h1>Object Moved</h1>This object may be found <a href="lumarquivos_ipn.asp">here</a>.</body>
</html>

<html><head><title>Object moved</title></head>
<body><h1>Object Moved</h1>This object may be found <a href="/arquivos1/lum-arquivos_ipn.asp?idioma=pt-BR&amp;status=">here</a>.</body>
</html>

<html><head><title>Object moved</title></head>
<body><h1>Object Moved</h1>This object may be found <a href="/arquivos1/lum-arquivos_ipn.asp?idioma=pt-BR&amp;status=ativo">here</a>.</body>
</html>

http://www.bmf.com.br/arquivos1/lum-arquivos_ipn.asp?idioma=pt-BR&status=ativo
对象已移动
对象已移动可以找到此对象。
移动的对象
对象已移动可以找到此对象。
移动的对象
对象已移动可以找到此对象。
http://www.bmf.com.br/arquivos1/lum-arquivos_ipn.asp?idioma=pt-BR&status=ativo

而不是我想要的那个(应该指向文件的位置)。我做错了什么?

当我删除每个标题键时,它都起作用了,除了Referer和Content Type,正如我在Hull.It上测试的那样,这是唯一两个必需的标题。我还是不明白为什么会这样。
<html><head><title>Object moved</title></head>
<body><h1>Object Moved</h1>This object may be found <a href="lumarquivos_ipn.asp">here</a>.</body>
</html>

<html><head><title>Object moved</title></head>
<body><h1>Object Moved</h1>This object may be found <a href="/arquivos1/lum-arquivos_ipn.asp?idioma=pt-BR&amp;status=">here</a>.</body>
</html>

<html><head><title>Object moved</title></head>
<body><h1>Object Moved</h1>This object may be found <a href="/arquivos1/lum-arquivos_ipn.asp?idioma=pt-BR&amp;status=ativo">here</a>.</body>
</html>

http://www.bmf.com.br/arquivos1/lum-arquivos_ipn.asp?idioma=pt-BR&status=ativo