提供 html 片段并使用 urlfetch
我正在尝试“模块化”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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您当前正在序列化 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!