crawler: ignore ssl via env var
This commit is contained in:
		@@ -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
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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')
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user