def __init__(self, prepay_id, sign_type="MD5"): params = { "appId": wx_conf.app_id, "timeStamp": int(time.time()), "nonceStr": com.create_nonce_str(), "package": "prepay_id=%s" % prepay_id, "signType": sign_type, } params["paySign"] = create_sign(params, key=wx_conf.key) params['timestamp'] = params["timeStamp"] del params['timeStamp'] self._params = params
def __init__(self, url, app_list=None, debug=False): self.params = {"debug": debug, "appId": wx_conf.app_id, "timestamp": int(time.time()), "nonceStr": com.create_nonce_str(), "url": url} self.params["signature"] = self._create_signature(self.params) self.app_list = app_list or [] self.params["jsApiList"] = self.app_list