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

bozo_exception': URLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED #33

Open
simonw opened this issue Nov 2, 2022 · 1 comment

Comments

@simonw
Copy link

simonw commented Nov 2, 2022

I tried running feediverse with some feeds configured and it exited without publishing anything - and adding -v didn't show me what was going on.

Eventually I hacked in enough print statements to get this output:

feed obj is {'bozo': True, 'entries': [], 'feed': {}, 'headers': {}, 'bozo_exception': URLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)'))}

It looks like feedparser returned that error in a dictionary that included an empty "entries": [] array - so feediverse failed silently rather than showing the error.

As for the error itself... I managed to fix that by adding the following to the top of feediverse.py:

import ssl
ssl._create_default_https_context=ssl._create_unverified_context

Based on this StackOveflow tip: https://stackoverflow.com/questions/40666767/how-to-fix-ssl-certificate-verify-failed-feedparser

@simonw
Copy link
Author

simonw commented Nov 2, 2022

Two fixes I suggest:

  • Spot bozo_exception and turn it into a real error, so that the tool doesn't fail silently
  • I guess add a --unsafe-ssl option that applies that nasty SSL hack, unless there's a better way?

The two feeds of mine which caused that error (which have perfectly valid SSL certificates as far as I can tell) were:

feeds:
- template: '{title} {url}'
  url: https://simonwillison.net/atom/everything/
- template: '{title} {link}'
  url: https://til.simonwillison.net/tils/feed.atom

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

1 participant