From c311b8e3512aef427d1c9d53758635910ad91e31 Mon Sep 17 00:00:00 2001 From: Timmy Welch Date: Fri, 12 Apr 2024 14:39:34 -0700 Subject: [PATCH] Use comicapi for all urllib3 items --- comicapi/utils.py | 1 + comictaggerlib/taggerwindow.py | 8 +++----- comictalker/talkers/comicvine.py | 3 +-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/comicapi/utils.py b/comicapi/utils.py index e74248a..91239a5 100644 --- a/comicapi/utils.py +++ b/comicapi/utils.py @@ -33,6 +33,7 @@ from comicfn2dict import comicfn2dict import comicapi.data from comicapi import filenamelexer, filenameparser +from ._url import LocationParseError as LocationParseError # noqa: F401 from ._url import Url as Url from ._url import parse_url as parse_url diff --git a/comictaggerlib/taggerwindow.py b/comictaggerlib/taggerwindow.py index c950918..3672591 100644 --- a/comictaggerlib/taggerwindow.py +++ b/comictaggerlib/taggerwindow.py @@ -30,9 +30,7 @@ from typing import Any, Callable import natsort import settngs -import urllib3.util from PyQt5 import QtCore, QtGui, QtNetwork, QtWidgets, uic -from urllib3.util.url import LocationParseError import comictaggerlib.ui from comicapi import utils @@ -1000,7 +998,7 @@ class TaggerWindow(QtWidgets.QMainWindow): md.scan_info = utils.xlate(self.leScanInfo.text()) md.series_groups = utils.split(self.leSeriesGroup.text(), ",") md.alternate_series = self.leAltSeries.text() - md.web_links = [urllib3.util.parse_url(self.leWebLink.item(i).text()) for i in range(self.leWebLink.count())] + md.web_links = [utils.parse_url(self.leWebLink.item(i).text()) for i in range(self.leWebLink.count())] md.characters = set(utils.split(self.teCharacters.toPlainText(), "\n")) md.teams = set(utils.split(self.teTeams.toPlainText(), "\n")) md.locations = set(utils.split(self.teLocations.toPlainText(), "\n")) @@ -1383,9 +1381,9 @@ class TaggerWindow(QtWidgets.QMainWindow): row = 0 web_link = self.leWebLink.item(row).text() try: - urllib3.util.parse_url(web_link) + utils.parse_url(web_link) webbrowser.open_new_tab(web_link) - except LocationParseError: + except utils.LocationParseError: QtWidgets.QMessageBox.warning(self, "Web Link", "Web Link is invalid.") def show_settings(self) -> None: diff --git a/comictalker/talkers/comicvine.py b/comictalker/talkers/comicvine.py index 0a666f5..a67f9c5 100644 --- a/comictalker/talkers/comicvine.py +++ b/comictalker/talkers/comicvine.py @@ -29,12 +29,11 @@ import requests import settngs from pyrate_limiter import Limiter, RequestRate from typing_extensions import Required, TypedDict -from urllib3.exceptions import LocationParseError -from urllib3.util import parse_url from comicapi import utils from comicapi.genericmetadata import ComicSeries, GenericMetadata, TagOrigin from comicapi.issuestring import IssueString +from comicapi.utils import LocationParseError, parse_url from comictalker import talker_utils from comictalker.comiccacher import ComicCacher, Issue, Series from comictalker.comictalker import ComicTalker, TalkerDataError, TalkerNetworkError