magic-wormhole/src/wormhole/send_text.py

20 lines
482 B
Python
Raw Normal View History

2015-02-11 00:50:32 +00:00
import sys, json
from . import api
APPID = "lothar.com/wormhole/text-xfer"
# we're sending
message = sys.argv[1]
blob = json.dumps({"message": message,
}).encode("utf-8")
i = api.Initiator(APPID, blob)
code = i.start()
print("Wormhole code is '%s'" % code)
print("On the other computer, please run:")
print()
print(" wormhole-receive-text %s" % code)
print()
them_bytes = i.finish()
them_d = json.loads(them_bytes.decode("utf-8"))
print("them: %r" % (them_d,))