2010-05-14 162 views

回答

4

是的。這裏更多的信息:http://code.google.com/appengine/docs/python/urlfetch/overview.html

您可以使用Python標準 庫的urllib,urllib2的或httplib的 使HTTP請求。在 App Engine中運行時,這些庫使用App Engine的URL 提取服務執行 HTTP請求,該服務在Google的 可伸縮HTTP請求基礎結構上運行。

下面是一個例子:

import urllib 
from xml.dom import minidom 
from google.appengine.api import urlfetch 

params = urllib.urlencode({'p': loc_param, 'u': units,}) 
full_uri = '?'.join([url, params,]) 

result = urlfetch.fetch(full_uri) 
if result.status_code == 200: 
    return minidom.parseString(result.content) 
+0

謝謝亞當。 – pocoa 2010-05-14 14:20:18

+1

您也可以直接使用urllib和urllib2;他們修補爲您使用urlfetch服務。 – geoffspear 2010-05-14 17:10:31