from tpns import Push from tpns.push import Android, AndroidMessage from tpns.core.authenticators import BasicAuthenticator #test zgq #test zgq username = 1500001533 password = "******" token = "038f7011515ffff9e8337864873cd83d271c" tag = "guoqing_a" accoount = "guoqing_a" upload_id = 36217 token_upload_id = 35718 authenticator = BasicAuthenticator(username=username, password=password) android_push = Push(authenticator=authenticator, zone=ZONE_GZ) android_push_data = { "audience_type": "all", "environment": "product", "message_type": "notify", "message": { "title": "推送标题-all", "content": "推送内容-all", "ios": { "aps": { "alert": { "subtitle": "推送副标题-all" }, "badge_type": -2,
import pytest from tpns.common import ZONE_GZ from tpns import Push from tpns.push import Android, AndroidMessage from tpns.core.authenticators import BasicAuthenticator username = 1500001533 password = "******" token = "038f7011515ffff9e8337864873cd83d271c" tag = "guoqing_a" account = "guoqing_a" upload_id = 36217 token_upload_id = 35718 authenticator = BasicAuthenticator() android_push = Push(authenticator=authenticator, zone=ZONE_GZ) android_push_data = { "audience_type": "package_account_push", "message_type": "notify", "upload_id": upload_id, "message": { "title": "推送标题-account-package", "content": "推送内容-account-package", "android": { "n_ch_id": "default_message", "n_ch_name": "默认通知", "n_id": 0, "builder_id": 0, "ring": 1,
import json from tpns.common import ZONE_GZ from tpns import Push from tpns.core.authenticators import BasicAuthenticator ######################### # iOS push,includes: # 1.all push # 2.tag push # 3.token push # 4.account push # 5.package token push # 6.package account push ######################### authenticator = BasicAuthenticator(username='******', password='******') ios_push = Push(authenticator=authenticator, zone=ZONE_GZ) # 1.all push ios_push_data = { "audience_type": "all", "environment": "product", "message_type": "notify", "message": { "title": "推送标题-all", "content": "推送内容-all", "ios": { "aps": { "alert": { "subtitle": "推送副标题-all"
import json from tpns.common import ZONE_GZ from tpns import Push from tpns.core.authenticators import BasicAuthenticator ######################### # add plan push ######################### authenticator = BasicAuthenticator(username='******', password='******') push = Push(authenticator=authenticator, zone=ZONE_GZ) data = {"planName": "TPNS_TEST123", "planDescribe": "plan_test"} response = push.add_plan_push(plan_name=data['planName'], plan_describe=data['planDescribe']) print(json.dumps(response.get_result(), indent=2))