fix send_tnps bug
This commit is contained in:
parent
fcd342ed21
commit
c36f0213bd
|
@ -10,11 +10,12 @@ from yunpian_python_sdk.ypclient import YunpianClient
|
||||||
from aliyunsdkdyvmsapi.request.v20170525 import SingleCallByTtsRequest
|
from aliyunsdkdyvmsapi.request.v20170525 import SingleCallByTtsRequest
|
||||||
from aliyunsdkcore.client import AcsClient
|
from aliyunsdkcore.client import AcsClient
|
||||||
import uuid
|
import uuid
|
||||||
|
import json
|
||||||
from aliyunsdkcore.profile import region_provider
|
from aliyunsdkcore.profile import region_provider
|
||||||
|
|
||||||
|
|
||||||
def send_tnps(phones, content):
|
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,
|
r = requests.post(url,
|
||||||
auth=HTTPBasicAuth(
|
auth=HTTPBasicAuth(
|
||||||
'1500015491', 'd5c793535529b6dc55d00b22302bad64'),
|
'1500015491', 'd5c793535529b6dc55d00b22302bad64'),
|
||||||
|
@ -22,10 +23,11 @@ def send_tnps(phones, content):
|
||||||
"audience_type": "account_list",
|
"audience_type": "account_list",
|
||||||
"account_list": phones,
|
"account_list": phones,
|
||||||
"message": {
|
"message": {
|
||||||
"title": content,
|
"title": "政务新媒体",
|
||||||
"content": ''
|
"content": content
|
||||||
},
|
},
|
||||||
"message_type": "notify"
|
"message_type": "notify",
|
||||||
|
"account_push_type": 1
|
||||||
})
|
})
|
||||||
return r
|
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')
|
# '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(
|
# og_title, og_description, og_url, og_image = parse(
|
||||||
# 'http://www.gov.cn/xinwen/2020-10/13/content_5550906.htm')
|
# 'http://www.gov.cn/xinwen/2020-10/13/content_5550906.htm')
|
||||||
og_title, og_description, og_url, og_image = parse(
|
# og_title, og_description, og_url, og_image = parse(
|
||||||
'http://gansu.gansudaily.com.cn/system/2021/01/25/030261998.shtml')
|
# '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'))
|
# print(send_voice_notify('13993199566'))
|
||||||
# r = send_tnps(['13609346975'], '')
|
r = send_tnps(['13609346975'], 'conteeeeent')
|
||||||
# print(r.status_code, r.text)
|
print(r.status_code, r.text)
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue