dashscope 1.20.0__py3-none-any.whl → 1.20.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of dashscope might be problematic. Click here for more details.

@@ -114,6 +114,7 @@ class Transcription(BaseAsyncApi):
114
114
  task: Union[str, TranscriptionResponse],
115
115
  api_key: str = None,
116
116
  workspace: str = None,
117
+ **kwargs
117
118
  ) -> TranscriptionResponse:
118
119
  """Fetch the status of task, including results of batch transcription when task_status is SUCCEEDED. # noqa: E501
119
120
 
@@ -131,7 +132,8 @@ class Transcription(BaseAsyncApi):
131
132
  try:
132
133
  response = super().fetch(task,
133
134
  api_key=api_key,
134
- workspace=workspace)
135
+ workspace=workspace,
136
+ **kwargs)
135
137
  except (asyncio.TimeoutError, aiohttp.ClientConnectorError) as e:
136
138
  logger.error(e)
137
139
  try_count += 1
@@ -150,6 +152,7 @@ class Transcription(BaseAsyncApi):
150
152
  task: Union[str, TranscriptionResponse],
151
153
  api_key: str = None,
152
154
  workspace: str = None,
155
+ **kwargs
153
156
  ) -> TranscriptionResponse:
154
157
  """Poll task until the final results of transcription is obtained.
155
158
 
@@ -161,7 +164,7 @@ class Transcription(BaseAsyncApi):
161
164
  Returns:
162
165
  TranscriptionResponse: The result of batch transcription.
163
166
  """
164
- response = super().wait(task, api_key=api_key, workspace=workspace)
167
+ response = super().wait(task, api_key=api_key, workspace=workspace, **kwargs)
165
168
  return TranscriptionResponse.from_api_response(response)
166
169
 
167
170
  @classmethod
@@ -250,6 +250,7 @@ class SpeechSynthesizer:
250
250
  speech_rate=speech_rate,
251
251
  pitch_rate=pitch_rate,
252
252
  )
253
+ self.last_request_id = self.request.task_id
253
254
  self.start_event = threading.Event()
254
255
  self.complete_event = threading.Event()
255
256
  self._stopped = threading.Event()
@@ -474,3 +475,7 @@ class SpeechSynthesizer:
474
475
  # 关闭WebSocket连接
475
476
  def close(self):
476
477
  self.ws.close()
478
+
479
+ # 获取上一个任务的taskId
480
+ def get_last_request_id(self):
481
+ return self.last_request_id
@@ -171,13 +171,20 @@ class AsyncTaskGetMixin():
171
171
  **kwargs) -> DashScopeAPIResponse:
172
172
  base_url = kwargs.pop('base_address', None)
173
173
  status_url = _normalization_url(base_url, 'tasks', task_id)
174
+ custom_headers = kwargs.pop('headers', None)
175
+ headers = {
176
+ **_workspace_header(workspace),
177
+ **default_headers(api_key),
178
+ }
179
+ if custom_headers:
180
+ headers = {
181
+ **custom_headers,
182
+ **headers,
183
+ }
174
184
  with requests.Session() as session:
175
185
  logger.debug('Starting request: %s' % status_url)
176
186
  response = session.get(status_url,
177
- headers={
178
- **_workspace_header(workspace),
179
- **default_headers(api_key),
180
- },
187
+ headers=headers,
181
188
  timeout=DEFAULT_REQUEST_TIMEOUT_SECONDS)
182
189
  logger.debug('Starting processing response: %s' % status_url)
183
190
  return _handle_http_response(response)
dashscope/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '1.20.0'
1
+ __version__ = '1.20.1'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: dashscope
3
- Version: 1.20.0
3
+ Version: 1.20.1
4
4
  Summary: dashscope client sdk library
5
5
  Home-page: https://dashscope.aliyun.com/
6
6
  Author: Alibaba Cloud
@@ -6,7 +6,7 @@ dashscope/files.py,sha256=QgJjwhtn9F548nCA8jD8OvE6aQEj-20hZqJgYXsUdQU,3930
6
6
  dashscope/finetune.py,sha256=_tflDUvu0KagSoCzLaf0hofpG_P8NU6PylL8CPjVhrA,6243
7
7
  dashscope/model.py,sha256=UPOn1qMYFhX-ovXi3BMxZEBk8qOK7WLJOYHMbPZwYBo,1440
8
8
  dashscope/models.py,sha256=1-bc-Ue68zurgu_y6RhfFr9uzeQMF5AZq-C32lJGMGU,1224
9
- dashscope/version.py,sha256=-WF9fGbBAG3Ia-pZ8ruKLHehAzfQDko1EUE6tUtxI8M,23
9
+ dashscope/version.py,sha256=50ZydhgZIM_dwezjbX2voC6nDV_wx5kxvUuz3Nl2Eig,23
10
10
  dashscope/aigc/__init__.py,sha256=s-MCA87KYiVumYtKtJi5IMN7xelSF6TqEU3s3_7RF-Y,327
11
11
  dashscope/aigc/code_generation.py,sha256=KAJVrGp6tiNFBBg64Ovs9RfcP5SrIhrbW3wdA89NKso,10885
12
12
  dashscope/aigc/conversation.py,sha256=xRoJlCR-IXHjSdkDrK74a9ut1FJg0FZhTNXZAJC18MA,14231
@@ -32,13 +32,13 @@ dashscope/audio/__init__.py,sha256=-ZRxrK-gV4QsUtlThIT-XwqB6vmyEsnhxIxdLmhCUuc,6
32
32
  dashscope/audio/asr/__init__.py,sha256=-s180qWn_JPSpCo1q0aDJJ5HQ3zTzD4z5yUwsRqH4aU,275
33
33
  dashscope/audio/asr/asr_phrase_manager.py,sha256=EjtbI3zz9UQGS1qv6Yb4zzEMj4OJJVXmwkqZyIrzvEA,7642
34
34
  dashscope/audio/asr/recognition.py,sha256=F2iz6hyXg16Z6DGlPwGpKfRNcAZIIsqXnNPtaZp4Fzo,17369
35
- dashscope/audio/asr/transcription.py,sha256=e5O1U51GT-OQPu-wWN2w_T7l6IopWuGMVkheOGdNCkk,8836
35
+ dashscope/audio/asr/transcription.py,sha256=1WAg9WH89antVzRYEKXb5LQP9xylZmX4YKp7v5oMYjY,8931
36
36
  dashscope/audio/tts/__init__.py,sha256=fbnieZX9yNFNh5BsxLpLXb63jlxzxrdCJakV3ignjlQ,194
37
37
  dashscope/audio/tts/speech_synthesizer.py,sha256=dnKx9FDDdO_ETHAjhK8zaMVaH6SfoTtN5YxXXqgY1JA,7571
38
38
  dashscope/audio/tts_v2/__init__.py,sha256=ve5a81qTbWDcRaSuritZtJBzryOIol2_dxzfqqdCw-k,345
39
- dashscope/audio/tts_v2/speech_synthesizer.py,sha256=yxBSV14z-1XEhuwl-ziZcRnGM1ZEHl26-UdWLocNClU,16490
39
+ dashscope/audio/tts_v2/speech_synthesizer.py,sha256=sv5f4vi17rFcYDif5bSS4UuX_2eVUL2q5rTnXK1EoAg,16650
40
40
  dashscope/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
- dashscope/client/base_api.py,sha256=rww7uoDJtKxgiFQlBpZ8p__J0087cJWhvUxtdb3rrTE,41064
41
+ dashscope/client/base_api.py,sha256=rXN97XGyDhCCaD_dz_clpFDjOJfpGjqiH7yX3LaD-GE,41233
42
42
  dashscope/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
43
43
  dashscope/common/api_key.py,sha256=5Stp0odL5JSuIO3qJBp23QNppuGbqhhvKPS66qbMs0I,1986
44
44
  dashscope/common/base_type.py,sha256=C9xP6WuN5pOzviZ2g3X2EPcigldtFE0VlaUmjyNnUUk,4619
@@ -82,9 +82,9 @@ dashscope/tokenizers/tokenizer.py,sha256=y6P91qTCYo__pEx_0VHAcj9YECfbUdRqZU1fdGT
82
82
  dashscope/tokenizers/tokenizer_base.py,sha256=REDhzRyDT13iequ61-a6_KcTy0GFKlihQve5HkyoyRs,656
83
83
  dashscope/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
84
84
  dashscope/utils/oss_utils.py,sha256=fi8-PPsN-iR-iv5k2NS5Z8nlWkpgUhr56FRWm4BDh4A,6984
85
- dashscope-1.20.0.dist-info/LICENSE,sha256=Izp5L1DF1Mbza6qojkqNNWlE_mYLnr4rmzx2EBF8YFw,11413
86
- dashscope-1.20.0.dist-info/METADATA,sha256=kihsPZv9KJsRIziMd9I0kMzdmq7Al_IQFix-9xLbh68,6641
87
- dashscope-1.20.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
88
- dashscope-1.20.0.dist-info/entry_points.txt,sha256=raEp5dOuj8whJ7yqZlDM8WQ5p2RfnGrGNo0QLQEnatY,50
89
- dashscope-1.20.0.dist-info/top_level.txt,sha256=woqavFJK9zas5xTqynmALqOtlafghjsk63Xk86powTU,10
90
- dashscope-1.20.0.dist-info/RECORD,,
85
+ dashscope-1.20.1.dist-info/LICENSE,sha256=Izp5L1DF1Mbza6qojkqNNWlE_mYLnr4rmzx2EBF8YFw,11413
86
+ dashscope-1.20.1.dist-info/METADATA,sha256=pcY6Qv8KtqGlNAiqRr0JEfAzXBH8N56KlUD3o3expoA,6641
87
+ dashscope-1.20.1.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
88
+ dashscope-1.20.1.dist-info/entry_points.txt,sha256=raEp5dOuj8whJ7yqZlDM8WQ5p2RfnGrGNo0QLQEnatY,50
89
+ dashscope-1.20.1.dist-info/top_level.txt,sha256=woqavFJK9zas5xTqynmALqOtlafghjsk63Xk86powTU,10
90
+ dashscope-1.20.1.dist-info/RECORD,,