2

While trying to use the SnapWrap library I've come across this error:

 File "/usr/local/lib/python2.7/dist-packages/requests-2.7.0-py2.7.egg/requests/adapters.py", line 431, in send raise SSLError(e, request=request) requests.exceptions.SSLError: hostname 'android.clients.google.com' doesn't match either of '*.google.com', '*.android.com', '*.appengine.google.com', '*.cloud.google.com', '*.google-analytics.com', '*.google.ca', '*.google.cl', '*.google.co.in', '*.google.co.jp', '*.google.co.uk', '*.google.com.ar', '*.google.com.au', '*.google.com.br', '*.google.com.co', '*.google.com.mx', '*.google.com.tr', '*.google.com.vn', '*.google.de', '*.google.es', '*.google.fr', '*.google.hu', '*.google.it', '*.google.nl', '*.google.pl', '*.google.pt', '*.googleadapis.com', '*.googleapis.cn', '*.googlecommerce.com', '*.googlevideo.com', '*.gstatic.cn', '*.gstatic.com', '*.gvt1.com', '*.gvt2.com', '*.metric.gstatic.com', '*.urchin.com', '*.url.google.com', '*.youtube-nocookie.com', '*.youtube.com', '*.youtubeeducation.com', '*.ytimg.com', 'android.com', 'g.co', 'goo.gl', 'google-analytics.com', 'google.com', 'googlecommerce.com', 'urchin.com', 'youtu.be', 'youtube.com', 'youtubeeducation.com' 

Using google I've come across this answer but haven't been able to find urllib3 in site-packages

How can this be fixed?

1
  • Well, you should first check if you have a Man-in-the-Middle attack going on and the library is right in refusing the connection. The listed wildcard certificates do not match the given hostname, so the error is okay. If i connect to the site, i get a wildcard certificate for '*.clients.google.com' from Google Internet Authority G2 with a very short validity (only 3 Months), rooted in Global Signs CA. Commented Jun 4, 2015 at 20:59

2 Answers 2

3

Your version of python does not support SNI yet, which is needed to get the proper certificates on sites which have multiple certificates per IP address.

Without SNI you get a certificate for *.google.com and others (see the error message), but none of these match the hostname android.clients.google.com because the wildcard matches only a single label and android.clients are two labels. But with SNI you get the certificate for *.clients.google.com which matches the provided hostname and validates fine.

SNI support for python is available with Python 3.x and with Python 2.7.9+, so you need to upgrade.

Sign up to request clarification or add additional context in comments.

Comments

-1

As you are using Python 2.7 you need to install request instead urllib3.

pip install request 

Please let me know if still you face the problems.

4 Comments

Could not find a version that satisfies the requirement request (from versions: ) No matching distribution found for request
This seems very strange - request is a one of the commonly used package. Considering you are using Python 2.7 that's appropriate package. Could you please let me know system configurations of your machine - such 32bit / 64bit?
Linux Inspiron 3.13.0-36-generic #63-Ubuntu SMP Wed Sep 3 21:30:07 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
@Robus could you please try with pip install urllib2 and let me know if it worked for you ?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.