Skip to content

Commit db08c65

Browse files
authored
Replace deprecated pkg_resources (#1363)
1 parent 482aa5b commit db08c65

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/client/delphi_epidata.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
from tenacity import retry, stop_after_attempt
1515

1616
from aiohttp import ClientSession, TCPConnector, BasicAuth
17-
from pkg_resources import get_distribution, DistributionNotFound
17+
from importlib.metadata import version, PackageNotFoundError
1818

1919
# Obtain package version for the user-agent. Uses the installed version by
2020
# preference, even if you've installed it and then use this script independently
2121
# by accident.
2222
try:
23-
_version = get_distribution("delphi-epidata").version
24-
except DistributionNotFound:
23+
_version = version("delphi-epidata")
24+
except PackageNotFoundError:
2525
_version = "0.script"
2626

2727
_HEADERS = {"user-agent": "delphi_epidata/" + _version + " (Python)"}

0 commit comments

Comments
 (0)