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()
Author:TANKING
Date:2021-8-1
WeChat:sansure2016
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。