Skip to content

Commit

Permalink
修改版本
Browse files Browse the repository at this point in the history
  • Loading branch information
刘志永 committed Sep 1, 2021
1 parent 5dda8ef commit c2c9b40
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion kernel/python/kernel/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.0.3'
__version__ = '1.0.4'
17 changes: 14 additions & 3 deletions kernel/python/kernel/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
from urllib.parse import urlencode
from kernel.config import Config
from kernel.context import Context
from Tea.response import TeaResponse

class MyEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, bytes):
return str(obj, encoding='utf-8');
return json.JSONEncoder.default(self, obj)

def merge(system_params, biz_params, text_params):
biz_params.update(system_params)
Expand Down Expand Up @@ -36,7 +42,7 @@ def sort_map(self,params):
return sort_map(params)

def read_as_json(self,teaResponse):
return json.dumps(teaResponse.__dict__)
return json.dumps(teaResponse.__dict__,cls=MyEncoder)

def sign(self,system_params,biz_params,text_params,secret_key):
mergeDic = merge(system_params,biz_params,text_params)
Expand Down Expand Up @@ -65,7 +71,10 @@ def build_query_string(self,sorted_dict):
return content
if __name__ == '__main__':
config = Config()
config.secretKey = '111'
context = Context(config)
key = context.get_config('secretKey')
print(key)
client = Client(context)
dic1 = {
'a':'2'
Expand All @@ -76,8 +85,10 @@ def build_query_string(self,sorted_dict):
dic3 = {
'c':'3'
}


teaResponse = TeaResponse()
teaResponse.headers = ''
JSONStr = client.read_as_json(TeaResponse)
print(JSONStr)
params = {
'code':'200',
'msg':'系统内部错误',
Expand Down
2 changes: 1 addition & 1 deletion kernel/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
AUTHOR_EMAIL = "alibaba-cloud-sdk-dev-team@list.alibaba-inc.com"
URL = "https://github.com/eleme/anubis-openapi-third/tree/main/kernel/python"
TOPDIR = os.path.dirname(__file__) or "."
VERSION = "1.0.3"
VERSION = "1.0.4"

with open("README.md", encoding="utf-8") as fp:
LONG_DESCRIPTION = fp.read()
Expand Down

0 comments on commit c2c9b40

Please sign in to comment.