From c22bd9ff4989fa723dcb9c44fbc416bb5a9be8eb Mon Sep 17 00:00:00 2001 From: apitamy Date: Thu, 20 Jun 2024 12:18:53 -0500 Subject: [PATCH 1/2] added selfsigned ignore code --- exporter.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/exporter.py b/exporter.py index 090834d..0dc71f8 100644 --- a/exporter.py +++ b/exporter.py @@ -13,6 +13,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 +297,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 +410,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 " From e1b85a0191afa93996403f64fe3ba2ce2f63abd6 Mon Sep 17 00:00:00 2001 From: apitamy Date: Thu, 20 Jun 2024 12:37:50 -0500 Subject: [PATCH 2/2] importssl --- exporter.py | 1 + 1 file changed, 1 insertion(+) diff --git a/exporter.py b/exporter.py index 0dc71f8..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