def main():
    """Send message from cron job."""
    args = config()
    conn = StaticConnection(
        (args.my_verkey, args.my_sigkey),
        their_vk=args.their_verkey,
        endpoint=args.endpoint,
    )
    conn.send({
        "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/"
        "basicmessage/1.0/message",
        "~l10n": {
            "locale": "en"
        },
        "sent_time": utils.timestamp(),
        "content": "The Cron script was executed."
    })
def main():
    """ Cron example. """
    args = config()
    conn = StaticConnection(
        (args.mypublickey, args.myprivatekey),
        their_vk=args.endpointkey,
        endpoint=args.endpoint,
    )
    conn.send({
        "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/"
        "basicmessage/1.0/message",
        "~l10n": {
            "locale": "en"
        },
        "sent_time": utils.timestamp(),
        "content": "The Cron Script has been executed."
    })
示例#3
0
def main():
    """ Cron with return route example. """
    args = config()
    conn = StaticConnection(
        args.mypublickey,
        args.myprivatekey,
        args.endpointkey,
        args.endpoint,
    )
    # TODO: a.returnroute = "thread"

    @conn.route(
        "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/trust_ping/1.0/ping_response")
    async def ping_response(_msg, _conn):
        """ Response to a ping. """
        print("Ping Response Returned")

    conn.send({
        "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/trust_ping/1.0/ping",
        "response_requested": True
    })