slko构造函数没有public名称。实例由返回SSLContext.wrap_插座().

2024-05-29 02:17:20 发布

您现在位置:Python中文网/ 问答频道 /正文

我创建了一个nameko服务,它向提供的电话号码发送文本消息。使用Africas Talking API。服务运行成功,但是一旦使用nameko shell,它就不能工作了。但是电话号码被成功地传递到服务中。在

Nameko壳牌公司:

 >>> n.rpc.sms.text('+254712619789')
    Traceback (most recent call last):
      File "<console>", line 1, in <module>
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/nameko/rpc.py", line 369, in __call__
        return reply.result()
      File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/nameko/rpc.py", line 327, in result
        raise deserialize(error)
    nameko.exceptions.RemoteError: TypeError GreenSSLSocket does not have a public constructor. Instances are returned by SSLContext.wrap_socket().

Nameko服务

^{pr2}$

在在.py在

import json
from nameko.web.handlers import http
from nameko.rpc import rpc
import africastalking

class HttpService(object):
    name = "sms"
    @rpc
    def text(self, phone_no):
        print (phone_no)
        africastalking.initialize(username, api_key)
        # Initialize a service e.g. SMS
        sms = africastalking.SMS
        # Use the service synchronously
        response = sms.send("Hello Message!", [phone_no])
        print(response)
        return response

Tags: notextinpyimportresponselinephone

热门问题