Modernize importlib.resources usage (#270)
See https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy
This commit is contained in:
parent
caf06e1001
commit
35c48766d7
2 changed files with 8 additions and 4 deletions
|
@ -1,7 +1,10 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
# Copyright (C) 2019-2022 Tobias Gruetzmacher
|
||||
# Copyright (C) 2019 Thomas W. Littauer
|
||||
from importlib.resources import path as get_path
|
||||
# SPDX-FileCopyrightText: © 2019 Tobias Gruetzmacher
|
||||
# SPDX-FileCopyrightText: © 2019 Thomas W. Littauer
|
||||
try:
|
||||
from importlib_resources import as_file, files
|
||||
except ImportError:
|
||||
from importlib.resources import as_file, files
|
||||
|
||||
from ..helpers import bounceStarter, joinPathPartsNamer
|
||||
from ..scraper import ParserScraper
|
||||
|
@ -25,7 +28,7 @@ class ComicsKingdom(ParserScraper):
|
|||
# slightly iffy hack taken from certifi
|
||||
# We need or own certificate bundle since ComicsKingdom screws up their
|
||||
# TLS setup from time to time, this should "fix" it)
|
||||
self.cert_ctx = get_path('dosagelib.data', 'godaddy-bundle-g2-2031.pem')
|
||||
self.cert_ctx = as_file(files('dosagelib.data') / 'godaddy-bundle-g2-2031.pem')
|
||||
self.session.add_host_options('comicskingdom.com', {
|
||||
'verify': str(self.cert_ctx.__enter__()),
|
||||
})
|
||||
|
|
|
@ -35,6 +35,7 @@ dependencies = [
|
|||
"requests>=2.0",
|
||||
"cached_property;python_version<'3.8'",
|
||||
"importlib_metadata;python_version<'3.8'",
|
||||
"importlib_resources>=5.0.0;python_version<'3.9'",
|
||||
]
|
||||
dynamic = ["version"]
|
||||
|
||||
|
|
Loading…
Reference in a new issue