Skip to content

Commit 8506445

Browse files
committed
Remove deprecated pkg_resources in favor of importlib.metadata
1 parent 15569c3 commit 8506445

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ classifiers = [
2020
]
2121
requires-python = ">=3.8"
2222
dependencies = [
23-
"setuptools",
2423
"pycryptodome",
2524
"bitarray"
2625
]

uid2_client/request_response_util.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import base64
2+
from importlib.metadata import version
23
import os
34
from urllib import request
45

5-
import pkg_resources
6-
76
from uid2_client.encryption import _encrypt_gcm, _decrypt_gcm
87

98

@@ -13,12 +12,12 @@ def _make_url(base_url, path):
1312

1413
def auth_headers(auth_key):
1514
try:
16-
version = pkg_resources.get_distribution("uid2_client").version
15+
client_version = version("uid2_client")
1716
except Exception:
18-
version = "non-packaged-mode"
17+
client_version = "non-packaged-mode"
1918

2019
return {'Authorization': 'Bearer ' + auth_key,
21-
"X-UID2-Client-Version": "uid2-client-python-" + version}
20+
"X-UID2-Client-Version": "uid2-client-python-" + client_version}
2221

2322

2423
def make_v2_request(secret_key, now, data=None):

0 commit comments

Comments
 (0)