AppEngine requests response content different from urlfetch and urllib2
I have tested outbound API requests using urlfetch, urllib2 and requests (with monkeypatch). Both urlfetch and urllib2 respond as expected, while requests is returning some Google tracking metadata/markup. This is the endpoint we are hitting: https://secure.current.stage.ariasystems.net/api/ws/api_ws_class_dispatcher.php Note: we do not control this endpoint so we can't be certain if the requests request ever reaches it.
urlfetch - as if we curl'd the page itself -- no interpretation of the response object https://markieta-playground.appspot.com/ariasystems/urlfetch
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="title" content="symfony project" />
<meta name="robots" content="index, follow" />
<meta name="description" content="symfony project" />
<meta name="keywords" content="symfony, project" />
<meta name="language" content="en" />
<title>symfony project</title>
<link rel="shortcut icon" href="/favicon.ico" />
<link rel="stylesheet" type="text/css" media="screen" href="/api/ws/sf/sf_default/css/screen.css" />
<!--[if lt IE 7.]>
<link rel="stylesheet" type="text/css" media="screen" href="/api/ws/sf/sf_default/css/ie.css" />
<![endif]-->
</head>
<body>
<div class="sfTContainer">
<a title="symfony website" href="http://www.symfony-project.org/"><img alt="symfony PHP Framework" class="sfTLogo" src="/api/ws/sf/sf_default/images/sfTLogo.png" height="39" width="186" /></a>
<div class="sfTMessageContainer sfTAlert">
<img alt="page not found" class="sfTMessageIcon" src="/api/ws/sf/sf_default/images/icons/tools48.png" height="48" width="48" />
<div class="sfTMessageWrap">
<h1>Oops! An Error Occurred</h1>
<h5>The server returned a "500 Internal Server Error".</h5>
</div>
</div>
<dl class="sfTMessageInfo">
<dt>Something is broken</dt>
<dd>Please e-mail us at [email] and let us know what you were doing when this error occurred. We will fix it as soon as possible.
Sorry for any inconvenience caused.</dd>
<dt>What's next</dt>
<dd>
<ul class="sfTIconList">
<li class="sfTLinkMessage"><a href="javascript:history.go(-1)">Back to previous page</a></li>
<li class="sfTLinkMessage"><a href="/">Go to Homepage</a></li>
</ul>
</dd>
</dl>
</div>
</body>
</html>
urllib2 - seems to parse the headers from the external server, and on a general error generates a 500 html document https://markieta-playground.appspot.com/ariasystems/urllib2
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>500 Internal Server Error</title>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.</p>
requests -- not sure what is going on here https://markieta-playground.appspot.com/ariasystems/requests
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "666666";
var google_conversion_label = "PzEjCLSUwQEQvPXz_gM";
var google_conversion_value = 0;
//-->
</script>
<script type="text/javascript" src="http://www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="http://www.googleadservices.com/pagead/conversion/1071446716/?label=PzEjCLSUwQEQvPXz_gM&guid=ON&script=0"/>
</div>
</noscript>
</body>
</html>