我要到微信請求二維碼,二維碼請求出來是“亂碼”,看網上說用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)
添加回答
舉報
0/150
提交
取消