28 lines
1.4 KiB
Python
28 lines
1.4 KiB
Python
import pydash
|
|
import requests
|
|
from rest_framework import status
|
|
from rest_framework.decorators import action
|
|
from rest_framework.request import Request
|
|
from rest_framework.response import Response
|
|
from rest_framework.viewsets import ViewSet
|
|
|
|
from sixGuoDjango import ResData, BaseResponse
|
|
from wechat_微信支付证书.江苏六果科技有限公司支付证书.江苏六果科技有限公司支付参数 import sixpay六果科技公司
|
|
|
|
|
|
class 获取稳定版接口调用凭据ViewSets(ViewSet):
|
|
@action(detail=False, methods=["get", "post", "put", "delete"], url_path="getStableAccessToken")
|
|
def 测试路由接口(self, request: Request):
|
|
""""""
|
|
uri = f"https://api.weixin.qq.com/cgi-bin/stable_token"
|
|
json_data = {
|
|
"grant_type": "client_credential", "appid": sixpay六果科技公司.appid, "secret": sixpay六果科技公司.appsecret,
|
|
"force_refresh": True
|
|
}
|
|
tokenData = requests.post(url=uri, json=json_data)
|
|
print(tokenData.json())
|
|
access_token = pydash.get(obj=tokenData.json(), path="access_token")
|
|
print("\n🍎 🍏 🍊 🍎 🍏 🍊 🍎 🍏 🍊 🍎 🍏 🍊 🍎 🍏 \n", access_token)
|
|
httpResData = BaseResponse(resData=ResData(listData=[""], dictData={"demo": "xiaozizi"}), ).model_dump()
|
|
return Response(data=httpResData, status=status.HTTP_200_OK)
|