has any easy way to get full url using python on gae

被刻印的时光 ゝ 提交于 2020-01-06 02:20:10

问题


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


回答1:


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?



来源:https://stackoverflow.com/questions/4094715/has-any-easy-way-to-get-full-url-using-python-on-gae

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!