We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a1ace3d commit 2279349Copy full SHA for 2279349
1 file changed
src/lpdb_python/session.py
@@ -15,11 +15,23 @@
15
)
16
import re
17
import warnings
18
+import importlib.metadata as metadata
19
20
import requests
21
22
__all__ = ["LpdbDataType", "LpdbError", "LpdbWarning", "LpdbSession"]
23
24
+_PACKAGE_NAME: Final[str] = "lpdb_python"
25
+
26
27
+@cache
28
+def _get_version() -> str:
29
+ try:
30
+ return metadata.version(_PACKAGE_NAME)
31
+ except metadata.PackageNotFoundError:
32
+ return "dev"
33
34
35
type LpdbDataType = Literal[
36
"broadcasters",
37
"company",
@@ -122,6 +134,7 @@ def _get_header(self) -> dict[str, str]:
122
134
"authorization": f"Apikey {self.__api_key}",
123
135
"accept": "application/json",
124
136
"accept-encoding": "gzip",
137
+ "user-agent": f"{_PACKAGE_NAME}/{_get_version()}",
125
138
}
126
139
127
140
@staticmethod
0 commit comments