提供 html 片段并使用 urlfetch

发布于 2024-08-18 03:25:05 字数 740 浏览 3 评论 0原文

我正在尝试“模块化”appengine 网站的一部分,其中将配置文件请求为一小块预渲染的 html

发送请求到 /userInfo?id=4992 发送一些 html,例如:

    <div>
    (image of john) John
    Information about this user
    </div>

所以,从我的 google appengine代码中,我需要在显示一群人时能够重复从此 URL 获取结果。

我现在能做到的唯一方法就是发送的集合。就像

    <iframe src="/userInfo?id=4992"></iframe>
    <iframe src="/userInfo?id=4993"></iframe>
    <iframe src="/userInfo?id=4994"></iframe>

iframe 用来请求数据一样。

我尝试使用 urlfetch.fetch() 但它一直计时出卖我。

我这样做对吗?我认为这会很方便(提供 html 片段的 URL),但事实证明它看起来像是一个设计错误。

I'm trying to "modularize" a section of an appengine website where a profile is requested as a small hunk of pre-rendered html

Sending a request to /userInfo?id=4992 sends down some html like:

    <div>
    (image of john) John
    Information about this user
    </div>

So, from my google appengine code, I need to be able to repeatedly fetch results from this URL when displaying a group of people.

The only way I can do it now is send down a collection of <iframes> like

    <iframe src="/userInfo?id=4992"></iframe>
    <iframe src="/userInfo?id=4993"></iframe>
    <iframe src="/userInfo?id=4994"></iframe>

The iframes work to request the data.

I tried using urlfetch.fetch() but it keeps timing out on me.

Am I doing this right? I thought this would be handy-dandy (url that serves up a snippet of html) but it turns out its looking like a design error.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

蓝天 2024-08-25 03:25:05

您当前正在序列化 urlfetch 请求,这最终会汇总它们的等待时间,并可能轻松地超出延迟期限。恐怕您需要切换到异步 urlfetch requests——一种可能更适合您的架构的先进技术!

You're currently serializing urlfetch requests, which ends up summing their wait times and may easily push you beyond your latency deadline. I'm afraid that you'll need to switch to async urlfetch requests -- an advanced technique which may suit your architecture better!

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