正则表达式在webapp2(Python)中提取URL参数,如URL' s?

时间:2016-11-01 20:59:02

标签: python google-app-engine webapp2

在routes.py中,我尝试过以下代码(不是正则表达式专家),并打算在url_arg中传递http / https链接,例如http://google.comhttps://google.com

r'/some_api/<url_arg:.*>'

以下是localhost的错误:8080 / some_api / https://google.com或localhost:8080 / some_api / http://google.com

Traceback (most recent call last):
  File "/google-cloud-sdk/platform/google_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 1292, in communicate
    req.parse_request()
  File "/google-cloud-sdk/platform/google_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 580, in parse_request
    success = self.read_request_line()
  File "/google-cloud-sdk/platform/google_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 643, in read_request_line
    scheme, authority, path = self.parse_request_uri(uri)
  File "/google-cloud-sdk/platform/google_appengine/lib/cherrypy/cherrypy/wsgiserver/wsgiserver2.py", line 805, in parse_request_uri
    authority, path = remainder.split(FORWARD_SLASH, 1)
ValueError: need more than 1 value to unpack

1 个答案:

答案 0 :(得分:1)

看起来这是cherrypy中的错误,由应用程序引擎的devappserver2使用。详细信息:https://code.google.com/archive/p/appengine-devappserver2-experiment/issues/69

(我有同样的问题,目前还没有好的解决方法或解决方法。)