来自 Google App Engine 的 urlfetch.fetch() 未显示在 Fiddler2 中
我正在我的 Windows 计算机上测试 Google App Engine 应用程序,在 localhost:8084 上本地运行。当我浏览我的应用程序时,Fiddler2 显示我的所有活动,但是当使用 urlfetch.fetch() 请求外部 url 时,它根本不会显示在 Fiddler 中,即使使用 http 而不是 https 地址,并且成功响应中的状态码 200。
我需要做什么才能让 Google App Engine 的 urlfetch.fetch() 请求显示在 Fiddler2 中?
I'm testing a Google App Engine app on my Windows machine, running locally on localhost:8084. Fiddler2 shows all my activity when I navigate around my app, but when requesting an external url with urlfetch.fetch() it doesn't show up in Fiddler at all, even when using an http, not an https address, and with a successful status code 200 in the response.
What do I need to do to get the urlfetch.fetch() request from Google App Engine to show up in Fiddler2?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的理解是Fiddler2作为HTTP代理运行;浏览器请求通过此代理而不是直接发送到互联网资源。这允许 Fiddler2 捕获有关请求和响应的信息。
根据 Fiddler2 文档,“您可以配置任何接受 HTTP 的应用程序通过 Fiddler 运行的代理,以便您可以调试其流量”。因此,我认为您需要更改 URLFetch API 调用以使用代理,提供 Fiddler URL 和端口。不过,URLFetch 文档并未具体说明如何做这个。您也许可以按照此问题中指定的方式使用 urllib2。
My understanding is that Fiddler2 runs as an HTTP proxy; browser requests go through this proxy instead of directly to the internet resource. This allows Fiddler2 to capture information about the request and the response.
According to the Fiddler2 docs, "You can configure any application which accepts a HTTP Proxy to run through Fiddler so you can debug its traffic". So I think you would need to change the URLFetch API call to use a proxy, supplying the Fiddler URL and port. However, the URLFetch documentation doesn't specify exactly how to do this. You might be able to use urllib2 as specified in this question.
伊鲁塞尔大体上是正确的,但我想让答案更具体。
由于 Google AppEngine 生产环境不支持代理,因此开发引擎也不直接支持代理。看来克服这个限制的唯一方法就是修改AppEngine开发服务器的代码。
您必须通过添加以下行来修改 urlfetch_stub.py 文件:
并且
您可以在我的博客文章 使用 Fiddler 调试 Google AppEngine 中的 urlfetch 请求
Irussell is generally right, but I'd like to make the answer more specific.
As proxies aren’t supported within Google AppEngine production environment, it’s not directly supported by development engine either. It seems that the only way to overcome this limitation is to modify the code of AppEngine development server.
You'll have to modify the urlfetch_stub.py file, by adding the following lines:
and
You may find the detailed explanation in my blog post Use Fiddler to debug urlfetch requests in Google AppEngine