diff --git a/exporter.py b/exporter.py index 090834d..bfab07a 100644 --- a/exporter.py +++ b/exporter.py @@ -6,6 +6,7 @@ from logging import info, error, debug from pathlib import Path import sys +import ssl from typing import Dict, List, Union from urllib.request import urlopen, Request import urllib.parse @@ -13,6 +14,11 @@ from time import time from time import sleep +# Ignore Self Signed Certificates +ctx = ssl.create_default_context() +ctx.check_hostname = False +ctx.verify_mode = ssl.CERT_NONE + # (formatName, fileExtension) FORMATS: Dict['str', 'str'] = { 'markdown': 'md', @@ -292,7 +298,7 @@ def api_get_bytes(path: str, **kwargs) -> bytes: request: Request = Request(request_path, headers=HEADERS) api_rate_limiter.limit_rate_request() - with urlopen(request) as response: + with urlopen(request, context=ctx) as response: if response.status == 403: error("403 Forbidden, check your token!") sys.exit(response.status) @@ -405,7 +411,7 @@ def export_attachments(attachments: List[Node]): request: Request = Request(content_url.geturl(), headers=HEADERS_NO_TOKEN) - with urlopen(request) as response: + with urlopen(request, context=ctx) as response: if response.status >= 300: error( "Could not download link-type attachment from "