This article uses Python to call the WeChat applet to obtain the access_token interface to obtain the request credentials. In order to facilitate the operation, here is combined with Python's own GUI library Tkinter.

import requests
import tkinter

def GetAccessToken():
    url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=你的APPID&secret=你的APPSECRET"
    res = requests.get(url)
    access_token = res.text
    print('已获得:'+access_token)

    # 写入JSON文件,缓存到本地JSON文件
    with open('access_token.json','w',encoding='utf-8') as f:
        f.write(access_token)
        
# GUI操作界面
root = tkinter.Tk()
root.geometry("500x300")
root.title("TANKING")
button = tkinter.Button(text="获取access_token",command=GetAccessToken)
button.pack()
button.mainloop()

image.png

Author:TANKING
Date:2021-8-1
WeChat:sansure2016


TANKING
4.8k 声望491 粉丝

热爱分享,热爱创作,热爱研究。