Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/hadoop/6.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.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请求模块-绕过ADF环回脚本访问网站_Python_Python Requests - Fatal编程技术网

Python请求模块-绕过ADF环回脚本访问网站

Python请求模块-绕过ADF环回脚本访问网站,python,python-requests,Python,Python Requests,我试图使用Python的请求模块访问一个网站,但我一直被重定向到另一个页面。我是新手,所以我不知道从哪里开始解决这个问题 我的代码是: import requests r = requests.get('https://swiftlink.enbridge.com/portal/') print r.text 但是,我没有在该页面上打印文本,而是从以下内容开始输出: <html lang="en-US"><head><script> /* ** Co

我试图使用Python的请求模块访问一个网站,但我一直被重定向到另一个页面。我是新手,所以我不知道从哪里开始解决这个问题

我的代码是:

import requests
r = requests.get('https://swiftlink.enbridge.com/portal/')
print r.text
但是,我没有在该页面上打印文本,而是从以下内容开始输出:

    <html lang="en-US"><head><script>
/*
** Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
*/

/**
 * This is the loopback script to process the url before the real page loads. It introduces
 * a separate round trip. During this first roundtrip, we currently do two things: 
 * - check the url hash portion, this is for the PPR Navigation. 
 * - do the new window detection
 * the above two are both controled by parameters in web.xml
 * 
 * Since it's very lightweight, so the network latency is the only impact. 
 * 
 * here are the list of will-pass-in parameters (these will replace the param in this whole
 * pattern: 
 *        viewIdLength                           view Id length (characters), 
 *        loopbackIdParam                        loopback Id param name, 
 *        loopbackId                             loopback Id,
 *        loopbackIdParamMatchExpr               loopback Id match expression, 
 *        windowModeIdParam                      window mode param name, 
 *        windowModeParamMatchExpr               window mode match expression, 
 *        clientWindowIdParam                    client window Id param name, 
 *        clientWindowIdParamMatchExpr           client window Id match expression, 
 *        windowId                               window Id, 
 *        initPageLaunch                         initPageLaunch, 
 *        enableNewWindowDetect                  whether we want to enable new window detection
 *        jsessionId                             session Id that needs to be appended to the redirect URL
 *        enablePPRNav                           whether we want to enable PPR Navigation
 *
 */

/*
**版权所有(c)2008,Oracle和/或其附属公司。版权所有。
*/
/**
*这是在加载实际页面之前处理url的环回脚本。它介绍
*单独往返。在第一次往返中,我们目前做了两件事:
*-检查url哈希部分,这用于PPR导航。
*-执行新窗口检测
*以上两个都由web.xml中的参数控制
* 
*因为它非常轻量级,所以网络延迟是唯一的影响。
* 
*以下是将传入的参数列表(这些参数将替换整个系统中的参数
*模式:
*viewIdLength视图Id长度(字符),
*loopbackIdParam loopback Id参数名称,
*环回Id环回Id,
*loopbackIdParamMatchExpr loopback Id匹配表达式,
*windowModeIdParam窗口模式参数名称,
*windowModeParamMatchExpr窗口模式匹配表达式,
*clientWindowIdParam客户端窗口Id参数名称,
*clientWindowIdParamMatchExpr客户端窗口Id匹配表达式,
*窗口Id窗口Id,
*initPageLaunch initPageLaunch,
*EnableNewIndowDetect是否要启用新窗口检测
*需要附加到重定向URL的jsessionId会话Id
*enablePPRNav是否要启用PPR导航
*
*/

在谷歌搜索了一段时间后,我发现我被重定向到一个Oracle ADF环回脚本页面,但我一直无法找到绕过它的方法。我曾尝试在代码中禁止重定向,但这只会导致我进入一些页面,说明我要找的页面已被临时移动。我知道我使用的url是有效的,since它将我带到正确的页面。

虽然不是对您问题的直接回答。请记住,HTTP是一种客户端-服务器协议,客户端请求数据,服务器响应所述数据,指示需要重定向或标记错误。HTTP服务器没有义务响应所请求的数据


我注意到URL中的协议是https。我不熟悉requests模块,但您可能需要检查它是否正确处理SSL套接字包装,因为这可能是错误源。

ADF页面需要附加参数。因此,您需要从第一次调用中提取这些参数,然后追加那些在新的请求,以查看页面

下面是一篇关于如何配置Jmeter的文章,它显示了需要哪些所有参数


使用Firebug或Google Chrome Developer工具嗅探此get url发出的所有网络请求。然后,您将能够说出引擎盖下发生的一切。您发布的html代码还包含一个javascript,该javascript使用某些参数调用另一个重定向,您需要使用参数理解该调用并进行该调用在进行原始请求调用后手动执行。此外,您需要为此使用对象。的可能重复项