Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 从应用程序引擎发送HTTP请求_Python_Google App Engine - Fatal编程技术网

Python 从应用程序引擎发送HTTP请求

Python 从应用程序引擎发送HTTP请求,python,google-app-engine,Python,Google App Engine,是否可以从AppEngine应用程序发送HTTP请求?我需要提出一些请求并从其他站点获取一些数据。是。更多信息请点击此处: 您可以使用Python标准 库urllib、urllib2或httplib 发出HTTP请求。磨合时 应用程序引擎,这些库执行 使用应用程序引擎URL的HTTP请求 获取服务,运行在谷歌的 可扩展的HTTP请求基础架构 下面是一个例子: import urllib from xml.dom import minidom from google.appengine.api i

是否可以从AppEngine应用程序发送HTTP请求?我需要提出一些请求并从其他站点获取一些数据。

是。更多信息请点击此处:

您可以使用Python标准 库urllib、urllib2或httplib 发出HTTP请求。磨合时 应用程序引擎,这些库执行 使用应用程序引擎URL的HTTP请求 获取服务,运行在谷歌的 可扩展的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)

您也可以直接使用urllib和urllib2;它们经过修补,可以为您使用urlfetch服务。