Skip to main content

Urlock-py

Urlock-py is a python library for connecting to a running urbit ship.

It consists of a single class Urlock. Methods are below.

__init__(url, code)

Constructor

`url` - url to the http interface of the running ship

`code` - the `+code` of the ship, should never be published

connect()

Connect to the running ship

poke(ship, app, mark, j)

`ship` - ship to send the poke

`app` - gall application to send the poke to

`mark` - mark of data sent to the gall application

`j` - json poke data

ack(eventId)

Send an acknowledgment of receipt of a message so it's cleared from the ship's queue 

`eventId` - id of the event to acknowledge

sse_pipe()

returns the sseclient object

subscribe(ship, app, path)

`ship` - ship on which the gall application lives

`app` - gall application to subscribe to

`path` - path to subscribe on

Follows is a simple script to send a message and subscribe to a chat channel. The specifics require an understanding of the chat-store and chat-hook interfaces.

#!/usr/bin/python3

import urlock
import baseconvert
import time
import random
import dumper

zod = urlock.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": "hello world!"}}}})


for m in pipe.events():
   dumper.dump(m)
   dumper.dump(zod.ack(int(m.id)))

Metadata

Release files for urlock 0.1.22

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for urlock 0.1.22
File Size Uploaded Provenance Actions
urlock-0.1.22.tar.gz 2.9 kB Without provenance Details for urlock-0.1.22.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for urlock 0.1.22
File Interpreter ABI Platform Actions
urlock-0.1.22-py3-none-any.whl Python 3 none any Details for urlock-0.1.22-py3-none-any.whl

Total release size: 6.7 kB

Release files / urlock-0.1.22.tar.gz

Download URL urlock-0.1.22.tar.gz
Size 2.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8cc24385bb88455db2c49ebd3aaacdfcc5c18e67b1e118c16ab65a1b9c0e9f2e
BLAKE2b-256 checksum
How to use checksums
4027a5889c64a3f95d42597b9e0b15f463c4cc679660a8499ace432947af43e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.5

Release files / urlock-0.1.22-py3-none-any.whl

Download URL urlock-0.1.22-py3-none-any.whl
Size 3.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9316a89c64e7d9488be46ffafb12e6fbdbbda7f6f8a1fe5c969a523a0a7b6d27
BLAKE2b-256 checksum
How to use checksums
bbc652a9959637e1a24eae5e428f10f2f6a5f790bc80445055581d645b0127cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.5

Security for urlock 0.1.22

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page