Python library for spartan
Go to file
Hedy Li 6a90f1768a
did I seriously forgot to add license lol
2021-07-15 10:41:18 +08:00
spartan initial 2021-07-15 10:14:24 +08:00
tests initial 2021-07-15 10:14:24 +08:00
.gitignore ignore 2021-07-15 10:35:14 +08:00
LICENSE did I seriously forgot to add license lol 2021-07-15 10:41:18 +08:00
README.md tab to spaces 2021-07-15 10:37:30 +08:00
pyproject.toml bump 2021-07-15 10:37:46 +08:00

README.md

spartan-py

Basic spartan protocol implementation as a python library.

import spartan

res = spartan.get("spartan://mozz.us/echo", "hi")
while True:
    buf = res.read()
    if not buf:
        break
    sys.stdout.buffer.write(buf)
res.close()

Try it in the REPL:

>>> import spartan
>>> req = spartan.Request("spartan.mozz.us")
>>> req
>>> <Request spartan.mozz.us:300 / 0>
>>> res = req.send()
>>> res
>>> 2 text/gemini
>>> res.read()
>>> [...]
>>> res.close()