Skip to content

Commit

Permalink
fix import
Browse files Browse the repository at this point in the history
  • Loading branch information
adbar committed Dec 14, 2023
1 parent ce67329 commit c29dfcf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
9 changes: 7 additions & 2 deletions trafilatura/downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,19 @@
from courlan import UrlStore
from courlan.network import redirection_test

from importlib.metadata import version
PKG_VERSION = version("trafilatura")
try: # Python 3.8+
from importlib.metadata import version
except ImportError:
from importlib_metadata import version


from .settings import DEFAULT_CONFIG
from .utils import (URL_BLACKLIST_REGEX, decode_response, make_chunks,
uniquify_list)


PKG_VERSION = version("trafilatura")

NUM_CONNECTIONS = 50
MAX_REDIRECTS = 2

Expand Down
8 changes: 6 additions & 2 deletions trafilatura/xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
from pathlib import Path
from pickle import load as load_pickle

from importlib.metadata import version
PKG_VERSION = version("trafilatura")
try: # Python 3.8+
from importlib.metadata import version
except ImportError:
from importlib_metadata import version

from lxml.etree import (Element, RelaxNG, SubElement, XMLParser, fromstring,
tostring)
Expand All @@ -26,6 +28,8 @@


LOGGER = logging.getLogger(__name__)
PKG_VERSION = version("trafilatura")

# validation
TEI_SCHEMA = str(Path(__file__).parent / 'data/tei-schema-pickle.lzma')
TEI_VALID_TAGS = {'ab', 'body', 'cell', 'code', 'del', 'div', 'graphic', 'head', 'hi', \
Expand Down

0 comments on commit c29dfcf

Please sign in to comment.