From c36f0213bd1f05c5d005058742ad59830a303e05 Mon Sep 17 00:00:00 2001 From: baoliang Date: Tue, 26 Jan 2021 23:33:40 +0800 Subject: [PATCH] fix send_tnps bug --- .DS_Store | Bin 10244 -> 10244 bytes polls/utils.py | 20 ++++++++++--------- polls/views/__pycache__/media.cpython-38.pyc | Bin 7906 -> 7906 bytes 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.DS_Store b/.DS_Store index 564a53de6819fc754945c51b1b276a86c0231e37..5462d4a3da599de48e46fdb11b591f16e963d847 100644 GIT binary patch delta 179 zcmZn(XbIS0Ai&gQH91B=VzQS&0;9m>)dI_z`n)GM2ue-P6Xat1|HI?z)BBU_1l15s zsm(_Obs5!UyBQc5*coye@)`0NG8syMbWv`;i%U{YeiBfIL-&stNUON80vm+6*;ZJS yk@48(bP+3dwHh9f?$ixYll+6zzNBtwluFk@*8R`IAEf)Zv;rH1x%sWMI1d1MJ3;3F delta 179 zcmZn(XbIS0Aiz|9aB_@*#AGjl1V)C*s|A)b^(IYj5R{snC&jzy@J%wiVW7 yWX#x{E@H*5RwW10ow^}vl7Dd8m(&f7Qt3L#x*OR8LAsAiE3iSBo8L-{^8f(CBs8)B diff --git a/polls/utils.py b/polls/utils.py index 2e2ab57..64e8ebc 100644 --- a/polls/utils.py +++ b/polls/utils.py @@ -10,11 +10,12 @@ from yunpian_python_sdk.ypclient import YunpianClient from aliyunsdkdyvmsapi.request.v20170525 import SingleCallByTtsRequest from aliyunsdkcore.client import AcsClient import uuid +import json from aliyunsdkcore.profile import region_provider def send_tnps(phones, content): - url = 'https://api.tpns.tencent.com//v3/push/app' + url = 'https://api.tpns.tencent.com/v3/push/app' r = requests.post(url, auth=HTTPBasicAuth( '1500015491', 'd5c793535529b6dc55d00b22302bad64'), @@ -22,10 +23,11 @@ def send_tnps(phones, content): "audience_type": "account_list", "account_list": phones, "message": { - "title": content, - "content": '' + "title": "政务新媒体", + "content": content }, - "message_type": "notify" + "message_type": "notify", + "account_push_type": 1 }) return r @@ -167,10 +169,10 @@ if __name__ == '__main__': # 'https://m.toutiao.com/i6883651337003729420/?tt_from=weixin&utm_campaign=client_share&app=news_article&utm_source=weixin&iid=1494959660475024&utm_medium=toutiao_android&wxshare_count=1') # og_title, og_description, og_url, og_image = parse( # 'http://www.gov.cn/xinwen/2020-10/13/content_5550906.htm') - og_title, og_description, og_url, og_image = parse( - 'http://gansu.gansudaily.com.cn/system/2021/01/25/030261998.shtml') + # og_title, og_description, og_url, og_image = parse( + # 'http://gansu.gansudaily.com.cn/system/2021/01/25/030261998.shtml') - print(og_title, og_description, og_url, og_image) + # print(og_title, og_description, og_url, og_image) # print(send_voice_notify('13993199566')) - # r = send_tnps(['13609346975'], '') - # print(r.status_code, r.text) + r = send_tnps(['13609346975'], 'conteeeeent') + print(r.status_code, r.text) diff --git a/polls/views/__pycache__/media.cpython-38.pyc b/polls/views/__pycache__/media.cpython-38.pyc index 6831a5b6f710a3043bc3c04920be15bd4bcc11f4..e209e0570163c1cd8000f3bc8e9ba300d3769607 100644 GIT binary patch delta 21 bcmaE4`^c6jl$V!_0SN5P1QIs#T$2L;KJEot delta 21 bcmaE4`^c6jl$V!_0SJQs{fghnb4?BaN___(