Introduction
Introduction
finger2gemtext is a small and simple library that provides code for
converting finger responses into the hypertext markup language of the
Gemini project.
Installation
finger2gemtext is available from
pypi and can be installed with your
package installer of choice.
With pip:
pip install finger2gemtext
With uv:
uv add finger2gemtext
Quick start
The library provides a single main conversion function called
finger_to_gemtext. It is passed a string that is the finger response you
wish to convert, and the result is a string that is the resulting Gemtext.
A very minimal converter might look like:
import fileinput
from .convert import finger_to_gemtext
def convert() -> None:
"""Parse the input from stdin or files and print the parsed Gemtext."""
with fileinput.input() as finger_content:
print(finger_to_gemtext("".join(finger_content)))
While it is primarily intended as a library to be used from other Python
code, it does contain a simple test command line tool, which can be accessed
either via the Python -m switch, or depending on your environment, via the
finger2gemtext command. For example, if you were to run this command:
finger @typed-hole.org | finger2gemtext
you'd get output like this:
[typed-hole.org]
Welcome to the Typed Hole
Uptime: 14:10:28 up 248 days, 22:12, 0 user, load average: 0.44, 0.34, 0.44
Users currently logged in: probably julien
Available fingers:
=> username username: get user infos
=> feed feed: get my latest toots
=> lobsters lobsters: get lobste.rs hottest stories
=> weather weather: get typed-hole.org current weather
=> temp temp: get typed-hole.org current CPU temperature
=> cyoa cyoa: finger your own adventure
=> textfile textfile: read a random textfile from textfiles.com
=> smog smog: read SMOG e-zine issues