We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7e46608 commit 1d878d4Copy full SHA for 1d878d4
1 file changed
analytics_mcp/tools/utils.py
@@ -22,10 +22,20 @@
22
import google.auth
23
import proto
24
25
+
26
+def _get_package_version_with_fallback():
27
+ """Returns the version of the package.
28
29
+ Falls back to 'unknown' if the version can't be resolved.
30
+ """
31
+ try:
32
+ return metadata.version("google-analytics-mcp")
33
+ except:
34
+ return "unknown"
35
36
37
# Client information that adds a custom user agent to all API requests.
-_CLIENT_INFO = ClientInfo(
- user_agent=f"analytics-mcp/{metadata.version('analytics-mcp')}"
-)
38
+_CLIENT_INFO = ClientInfo(user_agent=f"analytics-mcp/{_get_package_version_with_fallback()}")
39
40
# Read-only scope for Analytics Admin API and Analytics Data API.
41
_READ_ONLY_ANALYTICS_SCOPE = (
0 commit comments