Spyne 接收多个请求 [英] Spyne receiving multiple requests

查看:71
本文介绍了Spyne 接收多个请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找 spyne 以便能够制作一个处理 json 请求的网络服务.问题是我仍然没有设法让它一次为多个请求工作.

I'm looking at spyne to be able to make a webservice that handles requests in json. The problem is that I still didn't managed to get it working for more than one request at a time.

我认为这是https://github.com/arskom/spyne/blob/master/examples/async.py 可能会解决,但我似乎无法让它工作,因为在任何地方都找不到 get_callback_info() ......有谁知道如何处理多个的例子与 spyne 同时请求?谢谢!

I thought this https://github.com/arskom/spyne/blob/master/examples/async.py might solve, but I can't seem to make it work as the get_callback_info() isn't found anywhere... Does anyone know any example of how to handle multiple requests at the same time with spyne? Thanks!

推荐答案

你的意思是你不能让 Spyne 并发?这与 Spyne 无关,实现并发是传​​输的工作.

You mean you can't get Spyne to be concurrent? That has nothing to do with Spyne, it's the transport's job to implement concurrency.

我假设您参考了使用 wsgiref 的示例,参考 WSGI 实现,它不支持并发.好消息是,Spyne 可以并且正在像任何 Python 守护程序一样同时使用.

I assume you refer to the examples that use wsgiref, the reference WSGI implementation, which doesn't support concurrency. Good news is, Spyne can be and is being used as concurrently as any Python daemon can be.

您可以使用 TwistedWebResource 在异步模式下使用 Twisted 或在 WSGIApplication 同步模式下使用.您可以分别在resource.pywsgi.pyexamples/twisted 目录中找到相关示例.

You can use twisted in async mode with TwistedWebResource or in sync mode with WSGIApplication. You can find the relevant examples in examples/twisted directory in resource.py and wsgi.py respectively.

如果扭曲让你害怕(出于某种原因,它有一个完全没有根据的不适合胆小的人"的声誉)你可以使用cherrypy.我只是在 examples/cherry 目录中放了一个cherrypy wsgi 示例.

If twisted scares you (For some reason, it's got a totally baseless "not for the faint-hearted" kind of reputation) you can use cherrypy. I just put a cherrypy wsgi example in examples/cherry directory.

这篇关于Spyne 接收多个请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆