gpt4 book ai didi

python - 正则表达式提取 URI 参数,例如 webapp2 (Python) 中的 URL?

转载 作者:太空宇宙 更新时间:2023-11-03 16:00:23 24 4
gpt4 key购买 nike

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

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

这是 localhost:8080/some_api/https://google.com 的错误或本地主机: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

最佳答案

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

(我也有同样的问题,但还没有好的修复或解决方法。)

关于python - 正则表达式提取 URI 参数,例如 webapp2 (Python) 中的 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40368552/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com