|
# -*- coding: utf-8 -*-
from django.conf import settings
from pywe_custom_message import send_custom_wxa_message
from pywe_media import media_upload
from pywe_storage import RedisStorage
from utils.redis.connect import r
WECHAT = settings.WECHAT
def mediaupload(media_file=None, media_file_path=None):
wxcfg = WECHAT.get('JSAPI', {})
appid = wxcfg.get('appID')
secret = wxcfg.get('appsecret')
res = media_upload(media_file=media_file, media_file_path=media_file_path, appid=appid, secret=secret, token=None, storage=RedisStorage(r))
print(res)
def sendcustomwxamessage(openid=None, miniappid=None, pagepath=None, thumb_media_id=None, title=None):
wxcfg = WECHAT.get('JSAPI', {})
appid = wxcfg.get('appID')
secret = wxcfg.get('appsecret')
res = send_custom_wxa_message(openid=openid, miniappid=miniappid, pagepath=pagepath, thumb_media_id=thumb_media_id, title=title, appid=appid, secret=secret, token=None, storage=RedisStorage(r))
print(res)
|