Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@
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
import base64
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',
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 "
Expand Down