如何用CPython编写服务?

发布于 2024-08-25 05:25:52 字数 88 浏览 6 评论 0原文

CPython 是否有任何库可以帮助编写与绑定无关的服务?

我找到了一些适用于 Python 的 SOAP 库,但它缺少在运行时选择绑定的灵活性。

Does CPython have any library that helps to write binding-independent services?

I have found some SOAP libraries for Python, but it misses the flexibility of choosing the binding at runtime.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泪之魂 2024-09-01 05:25:52

诸如 SimpleXMLRPCServer 之类的包(部分Python 标准库的一部分)、SimpleJSONRPCServer,以及可能至少有一些 SOAP您找到的服务器端库(好的库;-)基于使用包注册函数和实例的概念,以使它们可供服务的客户端使用 - 基本上您编写服务的独立的功能,只需将该功能公开为函数和类(就像您对任何其他应用程序的核心逻辑所做的那样,而不仅仅是服务),然后在运行时(大概主要是在服务器启动时)注册这些函数,并且这些类的实例,因此它们可以作为“服务”访问。我将其称为“与绑定无关”的方法;-)。

Packages such as SimpleXMLRPCServer (part of the Python standard library), SimpleJSONRPCServer, and probably at least some of the SOAP server-side libraries you found (the good ones;-), are based on the concept of registering functions and instances with the package to make them available to clients of the service -- basically you write your service's functionality independently, just exposing that functionality as functions and classes (much as you would for any other application's core logic, not just a service), and then, at runtime (presumably, mostly at server startup time), you register those functions, and instances of those classes, so they become accessible as "the service". I'd call that pretty much a "binding-independent" approach;-).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文