【发布时间】:2015-03-23 04:24:43
【问题描述】:
我使用 web.py 做了一个网络服务
安装 web.py 光盘网络 编辑 python 网络服务。
#!/usr/bin/env python
urls = ('/title_matching2','title_matching2')
app = web.application(urls,globals())
class title_matching2:
def __init__(self):
self.hello = "hello world"
def GET(self):
getInput = web.input(name="World")
processing the data, return the hash table, I wanted
return gg
if __name__ == "__main__":
app.run()
然后我运行这个网络服务,./some.py,然后调用:
links http://localhost:8080/title_matching2?title=diehard
它返回一个哈希表,这是我想要的
但如果我使用多个参数运行 web 服务, 代码如下:
usr/bin/env python
urls = ('/title_matching4','title_matching4')
app = web.application(urls,globals())
class title_matching4:
def __init__(self):
self.hello = "hello world"
def GET(self):
getInput = web.input(title="World",prod="type")
title1=str(getInput.title)
prod1=str(getInput.prod)
processing the data, return the hash table I wanted.
return qq
if __name__ == "__main__":
app.run()
然后运行
./rest9.py
然后我使用链接打开了一个链接
http://localhost:8080/title_matching4?title=diehard&prod=feature
没有返回哈希表,虽然我想返回一个哈希表
屏幕上会出现如下内容:
[1] 1190
我想知道为什么?
为什么我无法打开链接并获取哈希表?
谢谢!
【问题讨论】:
-
您能否将代码简化为显示问题的最小示例?
-
谢谢。刚刚做到了!任何cmets,让我知道。谢谢!