8

I try to use requests to get a url of file. It works well locally but it doesn't work with nameko.

I tried 3 libs of python3.7. But all has the same error. import urllib.request,urllib3,requests

it works well locally like this:

import requests
url = "https://www.python.org/static/img/python-logo.png"
r = requests.get(url)
print(r.content)

But it can't work with nameko:

import requests
from nameko.web.handlers import http

@http("POST", "/import")
def testurl(self,request):
    url = "https://www.python.org/static/img/python-logo.png"
    r = requests.get(url)
    print(r.content)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/nameko/rpc.py", line 373, in __call__
    return reply.result()
  File "/usr/local/lib/python3.7/site-packages/nameko/rpc.py", line 331, in result
    raise deserialize(error)
nameko.exceptions.RemoteError: Exception Error on testurl: Cause : wrap_socket() got an unexpected keyword argument '_context'
4

2 回答 2

4

这是一个小事件错误。如果可能,您需要降级到 Python 3.6。

https://github.com/eventlet/eventlet/issues/526

Nameko 对此问题的 PR 处于暂停状态,直到上述问题得到修复。

https://github.com/nameko/nameko/pull/644

于 2019-12-19T14:48:07.943 回答
1

我在 python 3.7、eventlet 0.25.2、requests 2.24.0 中发现了同样的错误。它适用于请求 2.23.0

于 2020-07-01T04:23:35.103 回答