Skip to main content

Library for connecting to a running Urbit ship

Project description

from urlock import urlock.Urlock
import baseconvert
import time
import random
import dumper

zod = Urlock("http://localhost:8080", "lidlut-tabwed-pillex-ridrup")
r = zod.connect()
s = zod.subscribe("zod", "chat-store", "/mailbox/~/~zod/mc")

pipe = zod.sse_pipe()

s = baseconvert.base(random.getrandbits(128), 10, 32, string=True).lower()
uid = '0v' + '.'.join(s[i:i+5] for i in range(0, len(s), 5))[::-1]

p = zod.poke("zod", "chat-hook", "json", {"message": {"path": "/~/~zod/mc",
    "envelope": {"uid": uid,
                                                                    "number": 1,
                                                                    "author": "~zod",
                                                                    "when": int(time.time() * 1000),
                                                                    "letter": {"text": "this shit is new"}}}})


for m in pipe.events():
   dumper.dump(m)

0.1 2020-06-01

  • Initial publication

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

urlock-0.1.9.tar.gz (1.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page