bypass ssl security while fetching invalid https url
This commit is contained in:
parent
bae51858e6
commit
15415e369a
6 changed files with 54 additions and 4 deletions
|
@ -18,10 +18,11 @@
|
|||
|
||||
# standard library imports
|
||||
import feedparser
|
||||
import ssl
|
||||
import sys
|
||||
import re
|
||||
|
||||
def parseuri(config, clioption, feeds):
|
||||
def parseuri(config, clioption, feeds, ignoressl):
|
||||
'''Parse configuration value of the uri option of the rss section'''
|
||||
rssuri = ''
|
||||
feedname =''
|
||||
|
@ -48,6 +49,10 @@ def parseuri(config, clioption, feeds):
|
|||
sys.exit('{confoption} parameter in the [{section}] section of the configuration file is mandatory. Exiting.'.format(section=section, confoption=confoption))
|
||||
else:
|
||||
rssuri = clioption
|
||||
# ignore ssl if asked
|
||||
if ignoressl:
|
||||
if hasattr(ssl, '_create_unverified_context'):
|
||||
ssl._create_default_https_context = ssl._create_unverified_context
|
||||
# get the rss feed for rss parameter of [rss] section
|
||||
feed = feedparser.parse(rssuri)
|
||||
if not feed:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue