暂无描述

wxa_views.py 851B

    # -*- coding: utf-8 -*- from django.conf import settings from django_response import response from pywe_storage import RedisStorage from pywe_wxa_qrcode import get_wxa_code_unlimit from utils.qiniucdn import qiniu_file_url, upload from utils.redis.connect import r WECHAT = settings.WECHAT def get_wxa_code(request): scene = request.POST.get('scene', '') page = request.POST.get('page', '') wxcfg = WECHAT.get('MINIAPP', {}) appid = wxcfg.get('appID') secret = wxcfg.get('appsecret') res = get_wxa_code_unlimit(scene, page, res_to_base64=False, appid=appid, secret=secret, storage=RedisStorage(r)) if res.headers and res.headers.get('Content-disposition'): qiniu_url = qiniu_file_url(upload(res.content)) else: qiniu_url = '' return response(data={ 'qiniu_url': qiniu_url, })