0
是一個web應用程序與cherryPy一起構建,就像我在http://blaag.haard.se/Simple-REST-ful---ish--exposure-of-Python-APIs/中發現的一個真正寧靜的web服務?CherryPy索引是寧靜的web服務?
import cherrypy
def requesthandler(*pathargs, **kwargs):
cherrypy.response.status = "whatever"
return "Not implemented"
class PyRest(object):
def index(self, *args, **kwargs):
return requesthandler(*args, **kwargs)
index.exposed = True
CONF = {
'global': {
'server.socket_host': '0.0.0.0',
'server.socket_port': 8888,
}
}
if __name__ == '__main__':
ROOT = PyRest()
cherrypy.quickstart(ROOT, '/', CONF)
def application(environ, start_response):
cherrypy.tree.mount(PyRest(), '/', None)
return cherrypy.tree(environ, start_response)
我問它,因爲只有實現索引,當你調用Web應用程序,POST請求在日誌中顯示。
但是是一個web服務? –
@ tato469當它爲客戶做些什麼的時候它將會是一個web服務:)。嚴格來說,Web服務是基於SOAP的Web API。 – jwalker
好的,謝謝你的解釋。我做了一個「網絡服務」類似於這裏的例子,在Json中返回一個int,我不知道我是否可以稱之爲web服務。 –