2828 _handle_http_response ,
2929 _handle_http_stream_response ,
3030 default_headers ,
31+ get_api_module ,
3132 join_url ,
3233)
3334
@@ -69,7 +70,7 @@ def _handle_kwargs(
6970 custom_headers = kwargs .pop ("headers" , None )
7071 headers = {
7172 ** _workspace_header (workspace ),
72- ** default_headers (api_key ),
73+ ** default_headers (api_key , module = "tasks" ),
7374 }
7475 if custom_headers :
7576 headers = {
@@ -133,6 +134,7 @@ async def async_call(
133134 task = task ,
134135 function = function ,
135136 api_key = api_key ,
137+ sdk_module = get_api_module (cls .__module__ ),
136138 ** kwargs ,
137139 )
138140 # call request service.
@@ -373,7 +375,7 @@ async def list(
373375 api_key = get_default_api_key ()
374376 headers = {
375377 ** _workspace_header (workspace ),
376- ** default_headers (api_key ),
378+ ** default_headers (api_key , module = "tasks" ),
377379 }
378380 async with aiohttp .ClientSession (trust_env = True ) as session :
379381 response = await session .get (
@@ -486,6 +488,7 @@ async def call(
486488 task = task ,
487489 function = function ,
488490 api_key = api_key ,
491+ sdk_module = get_api_module (cls .__module__ ),
489492 ** kwargs ,
490493 )
491494 # call request service.
@@ -552,6 +555,7 @@ def call(
552555 task = task ,
553556 function = function ,
554557 api_key = api_key ,
558+ sdk_module = get_api_module (cls .__module__ ),
555559 ** kwargs ,
556560 )
557561 # call request service.
@@ -588,7 +592,7 @@ def _get(
588592 custom_headers = kwargs .pop ("headers" , None )
589593 headers = {
590594 ** _workspace_header (workspace ),
591- ** default_headers (api_key ),
595+ ** default_headers (api_key , module = "tasks" ),
592596 }
593597 if custom_headers :
594598 headers = {
@@ -687,7 +691,7 @@ def cancel(
687691 url ,
688692 headers = {
689693 ** _workspace_header (workspace ),
690- ** default_headers (api_key ),
694+ ** default_headers (api_key , module = "tasks" ),
691695 },
692696 )
693697 return _handle_http_response (response )
@@ -751,7 +755,7 @@ def list(
751755 params = params ,
752756 headers = {
753757 ** _workspace_header (workspace ),
754- ** default_headers (api_key ),
758+ ** default_headers (api_key , module = "tasks" ),
755759 },
756760 )
757761 if response .status_code == HTTPStatus .OK :
@@ -934,6 +938,7 @@ def async_call(
934938 api_key = api_key ,
935939 async_request = True ,
936940 query = False ,
941+ sdk_module = get_api_module (cls .__module__ ),
937942 ** kwargs ,
938943 )
939944 return request .call ()
@@ -946,6 +951,7 @@ def _get(
946951 api_key = None ,
947952 flattened_output = False ,
948953 workspace : str = None ,
954+ module : str = "" ,
949955 ** kwargs ,
950956) -> Union [DashScopeAPIResponse , Dict ]:
951957 timeout = kwargs .pop (
@@ -958,7 +964,7 @@ def _get(
958964 url ,
959965 headers = {
960966 ** _workspace_header (workspace ),
961- ** default_headers (api_key ),
967+ ** default_headers (api_key , module = module ),
962968 ** kwargs .pop ("headers" , {}),
963969 },
964970 params = params ,
@@ -1025,6 +1031,7 @@ def list(
10251031 params = params ,
10261032 api_key = api_key ,
10271033 workspace = workspace ,
1034+ module = get_api_module (cls .__module__ ),
10281035 ** kwargs ,
10291036 )
10301037
@@ -1060,6 +1067,7 @@ def list(
10601067 params = params ,
10611068 api_key = api_key ,
10621069 workspace = workspace ,
1070+ module = get_api_module (cls .__module__ ),
10631071 ** kwargs ,
10641072 )
10651073
@@ -1099,6 +1107,7 @@ def logs( # pylint: disable=unused-argument
10991107 params = params ,
11001108 api_key = api_key ,
11011109 workspace = workspace ,
1110+ module = get_api_module (cls .__module__ ),
11021111 ** kwargs ,
11031112 )
11041113
@@ -1142,6 +1151,7 @@ def get(
11421151 params = params ,
11431152 flattened_output = flattened_output ,
11441153 workspace = workspace ,
1154+ module = get_api_module (cls .__module__ ),
11451155 ** kwargs ,
11461156 )
11471157
@@ -1181,6 +1191,7 @@ def get(
11811191 api_key = api_key ,
11821192 flattened_output = flattened_output ,
11831193 workspace = workspace ,
1194+ module = get_api_module (cls .__module__ ),
11841195 ** kwargs ,
11851196 )
11861197
@@ -1225,7 +1236,7 @@ def delete(
12251236 url ,
12261237 headers = {
12271238 ** _workspace_header (workspace ),
1228- ** default_headers (api_key ),
1239+ ** default_headers (api_key , module = get_api_module ( cls . __module__ ) ),
12291240 ** kwargs .pop ("headers" , {}),
12301241 },
12311242 timeout = timeout ,
@@ -1275,7 +1286,7 @@ def call(
12751286 headers = {
12761287 "Content-Type" : "application/json; charset=utf-8" ,
12771288 ** _workspace_header (workspace ),
1278- ** default_headers (api_key ),
1289+ ** default_headers (api_key , module = get_api_module ( cls . __module__ ) ),
12791290 ** kwargs .pop ("headers" , {}),
12801291 },
12811292 timeout = timeout ,
@@ -1332,6 +1343,7 @@ def update(
13321343 flattened_output = kwargs .pop ("flattened_output" , False )
13331344 import json as _json # pylint: disable=reimported
13341345
1346+ module = get_api_module (cls .__module__ )
13351347 with requests .Session () as session :
13361348 logger .debug ("Starting request: %s" , url )
13371349 body = _json .dumps (json , ensure_ascii = False ).encode ("utf-8" )
@@ -1342,7 +1354,7 @@ def update(
13421354 headers = {
13431355 "Content-Type" : "application/json; charset=utf-8" ,
13441356 ** _workspace_header (workspace ),
1345- ** default_headers (api_key ),
1357+ ** default_headers (api_key , module = module ),
13461358 ** kwargs .pop ("headers" , {}),
13471359 },
13481360 timeout = timeout ,
@@ -1354,7 +1366,7 @@ def update(
13541366 headers = {
13551367 "Content-Type" : "application/json; charset=utf-8" ,
13561368 ** _workspace_header (workspace ),
1357- ** default_headers (api_key ),
1369+ ** default_headers (api_key , module = module ),
13581370 ** kwargs .pop ("headers" , {}),
13591371 },
13601372 timeout = timeout ,
@@ -1409,7 +1421,7 @@ def put(
14091421 headers = {
14101422 "Content-Type" : "application/json; charset=utf-8" ,
14111423 ** _workspace_header (workspace ),
1412- ** default_headers (api_key ),
1424+ ** default_headers (api_key , module = get_api_module ( cls . __module__ ) ),
14131425 ** kwargs .pop ("headers" , {}),
14141426 },
14151427 timeout = timeout ,
@@ -1461,7 +1473,7 @@ def upload( # pylint: disable=unused-argument
14611473 data = js ,
14621474 headers = {
14631475 ** _workspace_header (workspace ),
1464- ** default_headers (api_key ),
1476+ ** default_headers (api_key , module = get_api_module ( cls . __module__ ) ),
14651477 ** kwargs .pop ("headers" , {}),
14661478 },
14671479 files = files ,
@@ -1511,7 +1523,7 @@ def cancel(
15111523 url ,
15121524 headers = {
15131525 ** _workspace_header (workspace ),
1514- ** default_headers (api_key ),
1526+ ** default_headers (api_key , module = get_api_module ( cls . __module__ ) ),
15151527 ** kwargs .pop ("headers" , {}),
15161528 },
15171529 timeout = timeout ,
@@ -1618,7 +1630,7 @@ def stream_events(
16181630 url ,
16191631 headers = {
16201632 ** _workspace_header (workspace ),
1621- ** default_headers (api_key ),
1633+ ** default_headers (api_key , module = get_api_module ( cls . __module__ ) ),
16221634 ** kwargs .pop ("headers" , {}),
16231635 },
16241636 stream = True ,
0 commit comments