Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

icann scraping gets SSL certificate error #539

Open
sbenthall opened this issue Dec 20, 2021 · 4 comments
Open

icann scraping gets SSL certificate error #539

sbenthall opened this issue Dec 20, 2021 · 4 comments
Assignees
Milestone

Comments

@sbenthall
Copy link
Collaborator

$ python bin/collect_mail.py -u https://mm.icann.org/pipermail/cc-humanrights/
Traceback (most recent call last):
  File "/usr/lib/python3.9/urllib/request.py", line 1346, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "/usr/lib/python3.9/http/client.py", line 1253, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1299, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1248, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/lib/python3.9/http/client.py", line 1008, in _send_output
    self.send(msg)
  File "/usr/lib/python3.9/http/client.py", line 948, in send
    self.connect()
  File "/usr/lib/python3.9/http/client.py", line 1422, in connect
    self.sock = self._context.wrap_socket(self.sock,
  File "/usr/lib/python3.9/ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "/usr/lib/python3.9/ssl.py", line 1040, in _create
    self.do_handshake()
  File "/usr/lib/python3.9/ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1129)

Problematic because this data is used in this notebook:

https://github.com/datactive/bigbang/blob/main/examples/experimental_notebooks/Corr%20between%20centrality%20and%20community%200.1.ipynb

@sbenthall sbenthall added this to the 0.4 milestone Dec 20, 2021
@nllz
Copy link
Contributor

nllz commented Dec 21, 2021

This has to do with SSL verification for which a local installed SSL cert is needed. There are several workarounds, We either need to install local certificates, which should be something like this:

import SSL
ssl._create_default_https_context = ssl._create_stdlib_context

or disable SSL verification using this code (which is probably the wrong this to do):

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

@Christovis
Copy link
Collaborator

Such info would be good to document here I think.

@nllz
Copy link
Contributor

nllz commented Dec 22, 2021

But the problem is with the code and the environment, not the data sources, right?

@sbenthall sbenthall modified the milestones: 0.4, 0.5 Feb 1, 2022
@nllz
Copy link
Contributor

nllz commented Feb 11, 2022

Hmmm, problem does not exist if you remove the 's' from https... So this maybe have something to do with ICANN's mailman install config.

@sbenthall sbenthall modified the milestones: 0.5, 0.6 May 16, 2023
@sbenthall sbenthall modified the milestones: 0.6, 0.7 Aug 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants