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: 7 additions & 3 deletions python_anticaptcha/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
from .base import AnticaptchaClient
from pkg_resources import get_distribution, DistributionNotFound
try:
from importlib.metadata import version, PackageNotFoundError
except ImportError:
# Python < 3.8 fallback
from importlib_metadata import version, PackageNotFoundError
from .tasks import (
NoCaptchaTaskProxylessTask,
RecaptchaV2TaskProxyless,
Expand All @@ -23,7 +27,7 @@
AnticatpchaException = AnticaptchaException

try:
__version__ = get_distribution(__name__).version
except DistributionNotFound:
__version__ = version(__name__)
except PackageNotFoundError:
# package is not installed
pass