Skip to content

Commit 08f4670

Browse files
zgx949kevinlin09
authored andcommitted
fix: get platform_info and processor_info error
1 parent 68662a9 commit 08f4670

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

dashscope/api_entities/base_request.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,21 @@
1010

1111
class BaseRequest(ABC):
1212
def __init__(self) -> None:
13+
try:
14+
platform_info = platform.platform()
15+
except Exception:
16+
platform_info = "unknown"
17+
18+
try:
19+
processor_info = platform.processor()
20+
except Exception:
21+
processor_info = "unknown"
22+
1323
ua = 'dashscope/%s; python/%s; platform/%s; processor/%s' % (
1424
__version__,
1525
platform.python_version(),
16-
platform.platform(),
17-
platform.processor(),
26+
platform_info,
27+
processor_info,
1828
)
1929
self.headers = {'user-agent': ua}
2030
disable_data_inspection = os.environ.get(

0 commit comments

Comments
 (0)