https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/qrcode-link/qr-code/getUnlimitedQRCode.html
# 替换为你的场景参数和其他参数
width = 180
is_hyaline = False
# 获取 access token
access_token = get_access_token2()
print(access_token)
# 生成不限制次数的小程序码
qrcode_url = f'https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={access_token}'
page_path = 'pages/index/index' # 小程序页面路径,携带参数
qrcode_params = {
'path': page_path,
'scene':userID,
'width': width,
'is_hyaline': is_hyaline
}
qrcode_url = f'https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={access_token}' page_path = 'pages/index/index' # 小程序页面路径,携带参数 qrcode_params = { 'path': page_path, 'scene':userID, 'width': width, 'is_hyaline': is_hyaline } qrcode_response = requests.post(qrcode_url, json=qrcode_params) print(qrcode_response) qrcode_data = qrcode_response.content # print(qrcode_data) encoded_qrcode = base64.b64encode(qrcode_data).decode('utf-8')