如何在调用方法后写入stdout(自动进行通知系统(Iphone))

时间:2021-07-06 00:05:43

I'm trying to do a system of notifications automatic (Iphone) using https://github.com/simonwhitaker/PyAPNs. When you want to send a notification you call "apns.gateway_server.send_notification(key, payload)" and you have to enter the PEM pass phrase. Is there a way to enter this phrase through code?

我正在尝试使用https://github.com/simonwhitaker/PyAPNs自动进行通知系统(Iphone)。当您想要发送通知时,请调用“apns.gateway_server.send_notification(key,payload)”,然后您必须输入PEM密码短语。有没有办法通过代码输入这个短语?

Something like: call(apns.gateway_server.send_notification(key, payload), sys.stdout.write("my phars"))

类似于:call(apns.gateway_server.send_notification(key,payload),sys.stdout.write(“my phars”))

I don't know how to do it

我不知道怎么做

1 个解决方案

#1


0  

import apns

gate = apns.APNs('keyfile','certfile').gateway_server()
gate.send_notification(key,payload)

Is there a problem when you run this?

运行时有问题吗?

#1


0  

import apns

gate = apns.APNs('keyfile','certfile').gateway_server()
gate.send_notification(key,payload)

Is there a problem when you run this?

运行时有问题吗?