来自 Google App Engine 的 urlfetch.fetch() 未显示在 Fiddler2 中

发布于 2024-11-29 15:31:37 字数 269 浏览 1 评论 0原文

我正在我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

携君以终年 2024-12-06 15:31:37

我的理解是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.

靑春怀旧 2024-12-06 15:31:37

伊鲁塞尔大体上是正确的,但我想让答案更具体。

由于 Google AppEngine 生产环境不支持代理,因此开发引擎也不直接支持代理。看来克服这个限制的唯一方法就是修改AppEngine开发服务器的代码。

您必须通过添加以下行来修改 urlfetch_stub.py 文件:

connection = connection_class('127.0.0.1', 8888)

并且

full_path = protocol + "://" + host + full_path

您可以在我的博客文章 使用 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:

connection = connection_class('127.0.0.1', 8888)

and

full_path = protocol + "://" + host + full_path

You may find the detailed explanation in my blog post Use Fiddler to debug urlfetch requests in Google AppEngine

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文