#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @Copyright (C) ansjer cop Video Technology Co.,Ltd.All rights reserved. @AUTHOR: ASJRD018 @NAME: AnsjerFormal @software: PyCharm @DATE: 2019/1/3 16:46 @Version: python3.6 @MODIFY DECORD:ansjer dev @file: spnsss.py @Contact: chanjunkai@163.com """ import time import apns2 from var_dump import var_dump daytime = time.strftime("%Y%m%d%H%M", time.localtime(1547256103)) print(daytime) cli = apns2.APNSClient(mode="dev", client_cert="apns-dev.pem", password='111111') alert = apns2.PayloadAlert(body="body!", title="title!") payload = apns2.Payload(alert=alert) n = apns2.Notification(payload=payload, priority=apns2.PRIORITY_LOW) response = cli.push(n=n, device_token="ce85e307e4938ea71d9b2fb8f21de2224d4bb67c") var_dump(response) assert response.status_code == 200, response.reason assert response.apns_id