This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.

Please visit our production wiki at https://wiki.gentoo.org

Help talk:Contents

From Gentoo Wiki (test)
Jump to:navigation Jump to:search

I have a LINUX machine with the OpenNao distro (based on GENTOO). This machine has Python 2.7.3. I do not have root permissions. You can download an executable image in Virtualbox (OpenNAO OS VirtualBox 2.1.2) from the following link (you will probably have to create an account):

https://community.ald.softbankrobotics.com/en/resources/software/language/en-gb?sort_by=weight&sort_order=ASC&page=1

My problem is that I am trying to make a call request to an AZURE server that has TLS 1.2, with the following code:

import requests url = "www.example-url.com" # it is not a real url querystring = {"key":"value",} headers = {'token': "4bfd740f482d48a3a894445eb6a85a83",'Username': "user",'Password':"password"}

  1. response = requests.request("GET", url, headers=headers, params=querystring)

response = requests.get(url, headers=headers, params=querystring, timeout=30)

and I get the following error:

   /var/persistent/home/nao/.local/lib/python2.7/site-packages/urllib3/util/ssl_.py:339: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
 SNIMissingWarning

/var/persistent/home/nao/.local/lib/python2.7/site-packages/urllib3/util/ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings

 InsecurePlatformWarning

Traceback (most recent call last):

 File "heathrowFI-3.py", line 33, in <module>
   response = requests.get(url, headers=headers, params=querystring, timeout=30)
 File "/var/persistent/home/nao/.local/lib/python2.7/site-packages/requests/api.py", line 72, in get
   return request('get', url, params=params, **kwargs)
 File "/var/persistent/home/nao/.local/lib/python2.7/site-packages/requests/api.py", line 58, in request
   return session.request(method=method, url=url, **kwargs)
 File "/var/persistent/home/nao/.local/lib/python2.7/site-packages/requests/sessions.py", line 508, in request
   resp = self.send(prep, **send_kwargs)
 File "/var/persistent/home/nao/.local/lib/python2.7/site-packages/requests/sessions.py", line 618, in send
   r = adapter.send(request, **kwargs)
 File "/var/persistent/home/nao/.local/lib/python2.7/site-packages/requests/adapters.py", line 490, in send
   raise ConnectionError(err, request=request)

requests.exceptions.ConnectionError: ('Connection aborted.', error(104, 'Connection reset by peer')) I have tried to make the request on other machines (Windows, Ubuntu) with TLS 1.2 and the result is OK. To get the TLS version of each machine I used the following command

python -c "import json, urllib2; print json.load (urllib2.urlopen ('https://www.howsmyssl.com/a/check')) ['tls_version']" WINDOWS machine with python 2.7 and TLS 1.2 : The result of the request was OK.

UBUNTU machine with python 2.7 and TLS 1.2 : The result of the request was OK.

I think the error is caused by the TLS 1.0 version of the SSL used by NaoQi. The server to which I make the request is Azure and only supports TLS 1.2. I have checked its TLS in the browser:

TLS FROM THE SERVER

I have no possibility to update Python (I do not have root permissions).

Please, do you know how I can make the request work to the server? Should I update the TLS 1.0 to TLS 1.2 on the NAOQI machine? Do you know how to update it?.

Any help or suggestion would be welcome.

Thanks in advance, regards.