Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.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 urlfetch.fetch在应用程序引擎中的html脚本标记中获取了丢失的内容_Python_Google App Engine_Fetch_Urlfetch - Fatal编程技术网

Python urlfetch.fetch在应用程序引擎中的html脚本标记中获取了丢失的内容

Python urlfetch.fetch在应用程序引擎中的html脚本标记中获取了丢失的内容,python,google-app-engine,fetch,urlfetch,Python,Google App Engine,Fetch,Urlfetch,在我的应用程序中,当我使用urlfetch.fetch函数获取指定的url时,我发现我获取的内容对于某些特殊的html代码是空的 例如,url: 在real html源代码中,代码包括: <div class="content"> <div style="width: 219px; height: 262px;" id="gmap-auto3map-gmap0" class="gmap-control gmap-gmap gmap gmap-map gmap-auto3map-

在我的应用程序中,当我使用urlfetch.fetch函数获取指定的url时,我发现我获取的内容对于某些特殊的html代码是空的

例如,url: 在real html源代码中,代码包括:

<div class="content">
<div style="width: 219px; height: 262px;" id="gmap-auto3map-gmap0" class="gmap-control gmap-gmap gmap gmap-map gmap-auto3map-gmap">Javascript is required to view this map.</div>
<script type="text/javascript">
/* <![CDATA[ */
jQuery.extend(true, Drupal, { settings: { "gmap": { "auto3map":{ "width": "219px", "height": "262px", "zoom": 16, "maxzoom": "17","controltype": "Large", "align": "None", "maptype": "Map", "mtc":"none", "baselayers": { "Map": 1, "Satellite": 1, "Hybrid": 1 },"styles": { "line_default": [ "0000ff", "5", "45", "", "" ],"poly_default": [ "000000", "3", "25", "ff0000", "45" ] },"line_colors": [ "#00cc00", "#ff0000", "#0000ff" ], "behavior":{ "autozoom": true }, "markermode": "0", "id": "auto3map", "latitude":"31.239132", "longitude": "121.483506", "markers": [ { "latitude":"31.239132", "longitude": "121.483506", "markername": "small red","offset": 0, "opts": { "title": "克莉丝汀食品(宁波路店)" }, "text": "\x3cdiv class=\"gmap-popup\"\x3e\x3c/div\x3e" } ] } } } });
/* ]]> */
</script>
</div> 

查看此地图需要Javascript。
/*  */
但从我通过url获取得到的信息来看: 结果将是:

<div class="content">
<div style="width: 219px; height: 262px;" id="gmap-auto3map-gmap0" class="gmap-control gmap-gmap gmap gmap-map gmap-auto3map-gmap">Javascript is required view this map.</div>
<script type="text/javascript">
/* <![CDATA[ */
/* ]]> */
</script>

查看此地图时需要Javascript。
/*  */


/*和
/*]>*/
之间的所有javascript代码都丢失了,这是非常复杂的。有人知道这个问题吗?是否可以修复此问题?

可能服务器会根据用户代理插入不同的javascript(即Firefox与Internet Explorer的不同代码),对于
urlfetch
的用户代理,服务器会感到困惑,根本不会插入任何javascript。

也许服务器会根据用户代理插入不同的javascript(即Firefox与Internet Explorer的不同代码),对于
urlfetch
的用户代理,服务器变得混乱,根本没有插入任何javascript。

我从谷歌官方小组的谷歌应用引擎团队的开发者那里得到了回应,他在回应中说,用户代理可能是主要原因。但在我的curl测试中,响应确实包含所有内容,包括javascript代码。到目前为止,还没有进一步的重播。我从官方谷歌集团的谷歌应用引擎团队的开发者那里得到了回复,他在回复中说,用户代理可能是主要原因。但在我的curl测试中,响应确实包含所有内容,包括javascript代码。到目前为止,没有进一步的重播。