Skip to content

Take a look at gemini protocol #81

@rumca-js

Description

@rumca-js

http://geminiquickst.art/
https://en.wikipedia.org/wiki/Gemini_(protocol)
https://www.ilyameerovich.com/gemini-the-small-internet/
https://kevinboone.me/gemini_2026.html

maybe add support for gemini protocol?

import socket
import ssl
from urllib.parse import urlparse

def fetch_gemini(url: str) -> str:
    parsed = urlparse(url)
    host = parsed.hostname
    port = parsed.port or 1965

    context = ssl.create_default_context()

    with socket.create_connection((host, port)) as sock:
        with context.wrap_socket(sock, server_hostname=host) as ssock:
            ssock.sendall((url + "\r\n").encode())

            response = b""
            while True:
                data = ssock.recv(4096)
                if not data:
                    break
                response += data

    header, body = response.split(b"\r\n", 1)
    status, meta = header.decode().split(" ", 1)

    if not status.startswith("2"):
        raise Exception(f"Gemini error {status}: {meta}")

    return body.decode()

# usage
gmi = fetch_gemini("gemini://gemini.circumlunar.space/")
print(gmi)
from gemeaux.client import Client

client = Client()
response = client.request("gemini://gemini.circumlunar.space/")

print(response.status)
print(response.meta)
print(response.body.decode())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions