Skip to content

Commit 344a4ed

Browse files
committed
feat: update faq
1 parent 5dcdfc1 commit 344a4ed

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

FAQ.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,7 @@ configuration.schema = "http" # https or http
5353
configuration.debug = False # 是否开启调试
5454

5555
volcenginesdkcore.Configuration.set_default(configuration)
56-
```
56+
```
57+
58+
### 4. 对象转 Dict
59+
对于请求和响应的对象,可以通过 to_dict() 方法将其转换成 dict 类型

volcenginesdkcore/api_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from multiprocessing.pool import ThreadPool
99
import os
1010
import re
11+
import sys
1112
import tempfile
1213

1314
# python 2 and python 3 compatibility library
@@ -303,8 +304,7 @@ def __deserialize(self, data, klass, service):
303304
if klass in self.NATIVE_TYPES_MAPPING:
304305
klass = self.NATIVE_TYPES_MAPPING[klass]
305306
else:
306-
# black box for dynamic get models type
307-
klass = getattr(__import__(service + ".models"), klass)
307+
klass = getattr(sys.modules[service + ".models"], klass)
308308

309309
if klass in self.PRIMITIVE_TYPES:
310310
return self.__deserialize_primitive(data, klass)

0 commit comments

Comments
 (0)