File tree Expand file tree Collapse file tree 4 files changed +23
-3
lines changed Expand file tree Collapse file tree 4 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.
4
4
5
5
The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) .
6
6
7
+ ## [ 0.1.1] - 2025-03-26
8
+
9
+ ### Changed
10
+
11
+ - Include the package version when requesting a JWT
12
+
7
13
## [ 0.1.0] - 2025-02-13
8
14
9
15
### Added
Original file line number Diff line number Diff line change 1
- 0.1.0
1
+ 0.1.1
Original file line number Diff line number Diff line change 33
33
DebugMode ,
34
34
)
35
35
from speechmatics_flow .tool_function_param import ToolFunctionParam
36
- from speechmatics_flow .utils import read_in_chunks , json_utf8
36
+ from speechmatics_flow .utils import read_in_chunks , json_utf8 , get_version
37
37
38
38
LOGGER = logging .getLogger (__name__ )
39
39
@@ -652,9 +652,10 @@ async def get_temp_token(api_key):
652
652
"""
653
653
Used to get a temporary token from management platform api
654
654
"""
655
+ version = get_version ()
655
656
mp_api_url = os .getenv ("SM_MANAGEMENT_PLATFORM_URL" , "https://mp.speechmatics.com" )
656
657
endpoint = f"{ mp_api_url } /v1/api_keys?type=flow"
657
- body = {"ttl" : 300 , "client_ref " : "speechmatics-flow- python-client " }
658
+ body = {"ttl" : 300 , "sm-sdk " : f" python-{ version } " }
658
659
headers = {"Authorization" : f"Bearer { api_key } " , "Content-Type" : "application/json" }
659
660
response = httpx .post (endpoint , json = body , headers = headers )
660
661
response .raise_for_status ()
Original file line number Diff line number Diff line change 5
5
6
6
import asyncio
7
7
import concurrent .futures
8
+ import importlib .metadata
8
9
import inspect
9
10
import json
11
+ from pathlib import Path
10
12
11
13
12
14
def json_utf8 (func ):
@@ -50,3 +52,14 @@ async def read_in_chunks(stream, chunk_size):
50
52
if not audio_chunk :
51
53
break
52
54
yield audio_chunk
55
+
56
+
57
+ def get_version () -> str :
58
+ """Reads the version number from the package or VERSION file"""
59
+ try :
60
+ return importlib .metadata .version (__package__ )
61
+ except importlib .metadata .PackageNotFoundError :
62
+ version_path = Path (__file__ ).resolve ().parent .parent / "VERSION"
63
+ if version_path .exists ():
64
+ return version_path .read_text (encoding = "utf-8" ).strip ()
65
+ return "0.0.0"
You can’t perform that action at this time.
0 commit comments