【问题标题】:Error 405 Method not allowed错误 405 方法不允许
【发布时间】:2014-02-03 20:01:33
【问题描述】:

我正在使用谷歌应用引擎和 python 设计一个网络应用程序 在提取表单数据时,即。使用get请求的参数值在运行时出现如下错误:

405 方法不允许

该资源不允许使用 GET 方法。

以下是代码: 是 get mothos 创建问题还是有任何其他解决方案来获取参数值。

class PostBody(webapp2.RequestHandler):
        def post(self):
            stringContent=cgi.escape(self.request.get('txtLocation'))
            stringurl='http://maps.googleapis.com/maps/api/place/textsearch/json?query='|stringContent|'&sensor=false&key=mykey'

            result=json.load(urllib.urlopen(stringurl))

            self.response.write(result)

谢谢...

【问题讨论】:

  • 您的网址格式错误。您有一个http://,后跟一个https,在method 和您的查询字符串之前有一个空格。这是您尝试获取的正确网址吗?
  • ohhh 非常抱歉是输入错误但是程序中的url是正确的,只有一个http://,问题仍然存在..

标签: google-app-engine python-2.7


【解决方案1】:

尝试替换

def post(self)

通过

def get(self)

【讨论】:

  • 没问题。我记得在某个时候也遇到过这个问题:)
猜你喜欢
  • 2021-12-20
  • 2017-11-13
  • 2016-12-02
  • 2012-10-25
  • 2012-03-21
  • 2015-11-25
  • 1970-01-01
  • 2014-10-04
  • 2016-08-07
相关资源
最近更新 更多