diff --git a/README.md b/README.md index ebf1909..c90dad7 100644 --- a/README.md +++ b/README.md @@ -345,6 +345,7 @@ Generic: - `DEBUG=1`: to have some feedback from the script execution. Useful for debugging. +- `IGNORE_SSL=1`: to ignore SSL certs when fetch feeds and articles - `DELAY` sets the browser cache delay, only for HTTP clients - `TIMEOUT` sets the HTTP timeout when fetching rss feeds and articles diff --git a/morss/crawler.py b/morss/crawler.py index f074031..fe1805d 100644 --- a/morss/crawler.py +++ b/morss/crawler.py @@ -53,10 +53,6 @@ except NameError: CACHE_SIZE = int(os.getenv('CACHE_SIZE', 1000)) # max number of items in cache (default: 1k items) CACHE_LIFESPAN = int(os.getenv('CACHE_LIFESPAN', 60)) # how often to auto-clear the cache (default: 1min) -# uncomment the lines below to ignore SSL certs -#import ssl -#ssl._create_default_https_context = ssl._create_unverified_context - MIMETYPE = { 'xml': ['text/xml', 'application/xml', 'application/rss+xml', 'application/rdf+xml', 'application/atom+xml', 'application/xhtml+xml'], @@ -743,6 +739,11 @@ else: default_cache = CappedDict() +if 'IGNORE_SSL' in os.environ: + import ssl + ssl._create_default_https_context = ssl._create_unverified_context + + if __name__ == '__main__': req = adv_get(sys.argv[1] if len(sys.argv) > 1 else 'https://morss.it')