https://pay.weixin.qq.com/wiki/doc/api/index.html
https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_1
1.key设置路径:微信商户平台(pay.weixin.qq.com)-->账户设置-->API安全-->密钥设置
2.输入32位数字和大小写字母的组合,设置为apikey(密钥)
在apps/utils目录下新建key.py:
STR = [chr(i) for i in range(65,91)] print(STR) #65-91对应字符A-Z #[‘A‘, ‘B‘, ‘C‘, ‘D‘, ‘E‘, ‘F‘, ‘G‘, ‘H‘, ‘I‘, ‘J‘, ‘K‘, ‘L‘, ‘M‘, ‘N‘, ‘O‘, ‘P‘, ‘Q‘, ‘R‘, ‘S‘, ‘T‘, ‘U‘, ‘V‘, ‘W‘, ‘X‘, ‘Y‘, ‘Z‘] str = [chr(i) for i in range(97,123)] print(str) #a-z #[‘a‘, ‘b‘, ‘c‘, ‘d‘, ‘e‘, ‘f‘, ‘g‘, ‘h‘, ‘i‘, ‘j‘, ‘k‘, ‘l‘, ‘m‘, ‘n‘, ‘o‘, ‘p‘, ‘q‘, ‘r‘, ‘s‘, ‘t‘, ‘u‘, ‘v‘, ‘w‘, ‘x‘, ‘y‘, ‘z‘] number = [chr(i) for i in range(48,58)] #0-9 print(number) #[‘0‘, ‘1‘, ‘2‘, ‘3‘, ‘4‘, ‘5‘, ‘6‘, ‘7‘, ‘8‘, ‘9‘] total=STR+str+number import random # 生成32位由数字和大小字母组成的随机字符串key key=‘‘ for i in range(32): key+=random.choice(total) print(key)
广告小程序后端开发(18.交易系统:获取未兑付未过期的我的奖品,获取优惠券参数和兑付优惠券)
原文:https://www.cnblogs.com/xuepangzi/p/11053291.html