2010-05-14 160 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