我要到微信请求二维码,二维码请求出来是“乱码”,看网上说用base64什么的解码,我试了好几个都没解出来。
还有说把请求的内容存为图片。然而百度实在是太垃圾了,我没找到办法把内容存为图片
我用的python,不知道下一步应该怎么编代码
import requests import json appid='我的appid' secret='我的secret' request_access_token='https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={APPID}&secret={APPSECRET}'.format(APPID=appid,APPSECRET=secret) #{"access_token":"ACCESS_TOKEN","expires_in":7200} try: get_access_token = requests.get(request_access_token) get_access_token = get_access_token.json() access_token = get_access_token['access_token'] # print(access_token) requestString = 'https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={ACCESS_TOKEN}'.format(ACCESS_TOKEN=access_token) except: get_access_token = requests.get(request_access_token) get_access_token = get_access_token.json() access_token = get_access_token['access_token'] requestString = 'https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={ACCESS_TOKEN}'.format(ACCESS_TOKEN=access_token) my_params = {"scene":"1","path": "pages/detail/detail", "width": 430} r = requests.post(requestString,data=json.dumps(my_params)) print(r.text)
Camel97