request 接入api接口参数的排序与拼接
参数:
params = {
"method":"accountinfo",
"accesskey":self.accesskey,
"reqTime": nowtime,
}
排序在拼接
# 制作签名
def get_sign(self,params):
sorted_params = sorted(params.items(), key=lambda d: d[0], reverse=False)
encode_params = urllib.parse.urlencode(sorted_params)
print(encode_params)
输出结果
accesskey=519b3346-7198-47e3-81b8-20ce13513835&method=accountinfo&reqTime=1552547744117