1
votes

The requests package in Python seems to reference the incorrect SSL cert in Ubuntu. I'm using requests 2.6.2. The code runs fine on a Mac but fails on Ubuntu. I appreciate any help!

This request:

query_string = https://lsapi.seomoz.com/linkscape/links/youtube.com?Sort=page_authority&Source=page_to_page&Filter=internal&LinkCols=4&Limit=50&Offset=0

requests.get(query_string, auth=(self.accessid,self.key))

Produces this error output:

Traceback (most recent call last): File "/home/mark/venvs/nessus/local/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 3035, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "", line 1, in requests.get('https://lsapi.seomoz.com/linkscape/links/youtube.com?Sort=page_authority&Source=page_to_page&Filter=internal&LinkCols=4&Limit=50&Offset=0') File "/home/mark/venvs/nessus/local/lib/python2.7/site-packages/requests/api.py", line 69, in get return request('get', url, params=params, **kwargs) File "/home/mark/venvs/nessus/local/lib/python2.7/site-packages/requests/api.py", line 50, in request response = session.request(method=method, url=url, **kwargs) File "/home/mark/venvs/nessus/local/lib/python2.7/site-packages/requests/sessions.py", line 465, in request resp = self.send(prep, **send_kwargs) File "/home/mark/venvs/nessus/local/lib/python2.7/site-packages/requests/sessions.py", line 573, in send r = adapter.send(request, **kwargs) File "/home/mark/venvs/nessus/local/lib/python2.7/site-packages/requests/adapters.py", line 431, in send raise SSLError(e, request=request) SSLError: hostname 'lsapi.seomoz.com' doesn't match either of 'incapsula.com', ...

1
Workaround: provide verify=False param to requests.getmingaleg

1 Answers

0
votes

This question boils down to being the same as this one: the version of Python you're using does not support SNI. Follow the advice in this answer.