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'