有任何简单的方法来获得完整的网址使用python on gae [英] has any easy way to get full url using python on gae

查看:125
本文介绍了有任何简单的方法来获得完整的网址使用python on gae的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码:

  url =/ aa
结果= urlfetch.fetch(url)

但它会出错,因为您必须获取完整的网址,例如:http:/ /digu.com



所以任何简单的方法可以在我的代码中获得完整的url,



p>

解决方案

您的意思是您自己的应用程序的完整URL? 可能需要 self.request.host (这可能是例如digu.com)或 self.request.host_url 例如 http://digu.com )。

请参阅应用引擎请求课程的文档,以及也是基于它的 WebOb Request class



然而,为什么你要为你的ow创建一个urlfetch n应用程序?


this is my code:

url = "/aa"
result = urlfetch.fetch(url)

but it will be error , because you have to get the full url , like this :http://digu.com

so any easy way to get the full url in my code ,

thanks

解决方案

Do you mean the full URL of your own app?

You might want self.request.host (which would be eg digu.com) or self.request.host_url (which would be eg http://digu.com).

See the documentation for the app engine Request class, and also the WebOb Request class it is based on.

However, why would you make a urlfetch to your own app?

这篇关于有任何简单的方法来获得完整的网址使用python on gae的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆