Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dashscope/audio/asr/recognition.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,8 @@ def call( # type: ignore[override] # noqa: E501
f.close()
self._stop_stream_timestamp = time.time() * 1000
except Exception as e:
logger.error(e)
raise e
logger.debug(e)
raise

if not self._stream_data.empty():
self._running = True
Expand Down
11 changes: 5 additions & 6 deletions dashscope/audio/asr/transcription.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) Alibaba, Inc. and its affiliates.

import asyncio
import time
from typing import List, Union

import aiohttp
import requests

from dashscope.api_entities.dashscope_response import (
DashScopeAPIResponse,
Expand Down Expand Up @@ -148,8 +147,8 @@ def fetch(
workspace=workspace,
**kwargs,
)
except (asyncio.TimeoutError, aiohttp.ClientConnectorError) as e:
logger.error(e)
except (requests.Timeout, requests.ConnectionError) as e:
logger.debug(e)
try_count += 1
if try_count <= Transcription.MAX_QUERY_TRY_COUNT:
time.sleep(2)
Expand Down Expand Up @@ -230,8 +229,8 @@ def _launch_request(
workspace=workspace,
**kwargs,
)
except (asyncio.TimeoutError, aiohttp.ClientConnectorError) as e:
logger.error(e)
except (requests.Timeout, requests.ConnectionError) as e:
logger.debug(e)
try_count += 1
if try_count <= Transcription.MAX_QUERY_TRY_COUNT:
time.sleep(2)
Expand Down
4 changes: 2 additions & 2 deletions dashscope/audio/asr/translation_recognizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,8 +582,8 @@ def call( # type: ignore[override]
f.close()
self._stop_stream_timestamp = time.time() * 1000
except Exception as e:
logger.error(e)
raise e
logger.debug(e)
raise

if not self._stream_data.empty():
self._running = True
Expand Down
7 changes: 3 additions & 4 deletions dashscope/audio/asr/vocabulary.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) Alibaba, Inc. and its affiliates.

import asyncio
import time
from typing import List

import aiohttp
import requests

from dashscope.client.base_api import BaseApi
from dashscope.common.constants import ApiProtocol, HTTPMethod
Expand Down Expand Up @@ -68,8 +67,8 @@ def __call_with_input(self, input): # pylint: disable=redefined-builtin
workspace=self._workspace,
**self._kwargs,
)
except (asyncio.TimeoutError, aiohttp.ClientConnectorError) as e:
logger.error(e)
except (requests.Timeout, requests.ConnectionError) as e:
logger.debug(e)
try_count += 1
if try_count <= VocabularyService.MAX_QUERY_TRY_COUNT:
time.sleep(2)
Expand Down
11 changes: 5 additions & 6 deletions dashscope/audio/qwen_asr/qwen_transcription.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) Alibaba, Inc. and its affiliates.

import asyncio
import time
from typing import Union

import aiohttp
import requests

from dashscope.api_entities.dashscope_response import (
DashScopeAPIResponse,
Expand Down Expand Up @@ -108,8 +107,8 @@ def fetch(
workspace=workspace,
**kwargs,
)
except (asyncio.TimeoutError, aiohttp.ClientConnectorError) as e:
logger.error(e)
except (requests.Timeout, requests.ConnectionError) as e:
logger.debug(e)
try_count += 1
if try_count <= QwenTranscription.MAX_QUERY_TRY_COUNT:
time.sleep(2)
Expand Down Expand Up @@ -186,8 +185,8 @@ def _launch_request(
workspace=workspace,
**kwargs,
)
except (asyncio.TimeoutError, aiohttp.ClientConnectorError) as e:
logger.error(e)
except (requests.Timeout, requests.ConnectionError) as e:
logger.debug(e)
try_count += 1
if try_count <= QwenTranscription.MAX_QUERY_TRY_COUNT:
time.sleep(2)
Expand Down
7 changes: 3 additions & 4 deletions dashscope/audio/tts_v2/enrollment.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
# Copyright (c) Alibaba, Inc. and its affiliates.

import asyncio
import time
from typing import List

import aiohttp
import requests

from dashscope.client.base_api import BaseApi
from dashscope.common.constants import ApiProtocol, HTTPMethod
Expand Down Expand Up @@ -71,8 +70,8 @@ def __call_with_input( # pylint: disable=redefined-builtin
workspace=self._workspace,
**self._kwargs,
)
except (asyncio.TimeoutError, aiohttp.ClientConnectorError) as e:
logger.error(e)
except (requests.Timeout, requests.ConnectionError) as e:
logger.debug(e)
try_count += 1
if try_count <= VoiceEnrollmentService.MAX_QUERY_TRY_COUNT:
time.sleep(2)
Expand Down
Loading