- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我创建了一项 nameko 服务,该服务会向提供的电话号码发送短信。使用Africas Talking API 。该服务运行成功,但一旦使用 nameko shell,它就无法工作。但是,电话号码已成功传递到服务中。
滑子壳:
>>> 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 run at
starting services: sms
Connected to amqp://guest:**@127.0.0.1:5672//
+254712619789
error handling worker <WorkerContext [sms.text] at 0x10414a128>: GreenSSLSocket does not have a public constructor. Instances are returned by SSLContext.wrap_socket().
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/nameko/containers.py", line 391, in _run_worker
result = method(*worker_ctx.args, **worker_ctx.kwargs)
File "./at.py", line 23, in text
response = sms.send("Hello Message!", [phone_no])
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/africastalking/SMS.py", line 32, in send
return self._make_request(url, 'POST', headers=self._headers, params=None, data=data, callback=callback)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/africastalking/Service.py", line 92, in _make_request
res = self.__make_post_request(url=url, headers=headers, data=data, params=params)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/africastalking/Service.py", line 78, in __make_post_request
data=data,
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/api.py", line 112, in post
return request('post', url, data=data, json=json, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/sessions.py", line 512, in request
resp = self.send(prep, **send_kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/sessions.py", line 622, in send
r = adapter.send(request, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/adapters.py", line 445, in send
timeout=timeout
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/connectionpool.py", line 600, in urlopen
chunked=chunked)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/connectionpool.py", line 343, in _make_request
self._validate_conn(conn)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/connectionpool.py", line 849, in _validate_conn
conn.connect()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/connection.py", line 356, in connect
ssl_context=context)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/util/ssl_.py", line 359, in ssl_wrap_socket
return context.wrap_socket(sock, server_hostname=server_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/eventlet/green/ssl.py", line 402, in wrap_socket
return GreenSSLSocket(sock, *a, _context=self, **kw)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/eventlet/green/ssl.py", line 68, in __init__
ca_certs, do_handshake_on_connect and six.PY2, *args, **kw)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 788, in __init__
f"{self.__class__.__name__} does not have a public "
TypeError: GreenSSLSocket does not have a public constructor. Instances are returned by SSLContext.wrap_socket().
at.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
最佳答案
问题可能是 eventlet 与 python 3.7 不兼容。你能尝试使用 python 3.6 吗?
关于Python 和 Nameko - GreenSSLSocket 没有公共(public)构造函数。实例由 SSLContext.wrap_socket() 返回。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51512601/
我尝试使用 nameko rpc 服务器从 mysql 读取数据。这是服务器代码。 class SendService: name = 'url_feature_rpc_service'
您好,这是我的项目示例,我想使用 nameko run Test:A,而且我发现 class A 在运行此服务期间会反复初始化。实际上,我想连接到一个服务并重复做一些事情,我不想每次都初始化连接。那么
在尝试有关 python 框架 nameko 的非常基本的示例时,我收到如下错误:BlockingIOError: [WinError 10035] 无法立即完成非阻塞套接字操作 知道它从哪里来吗?
我正在使用 scrapy 创建一个示例网络爬虫作为 Nameko 依赖提供程序,但它没有爬行任何页面。下面是代码 import scrapy from scrapy import crawler fr
我正在编写一个小型 RPC 服务,该服务允许使用 nameko 和 sqlalchemy 对数据库进行远程 CRUD。对于某些方法/属性/事件处理程序,我的模型需要使用依赖项来获取一些数据。按照我希望
我创建了一项 nameko 服务,该服务会向提供的电话号码发送短信。使用Africas Talking API 。该服务运行成功,但一旦使用 nameko shell,它就无法工作。但是,电话号码已成
我是一名优秀的程序员,十分优秀!