{
  "id": 17791684,
  "title": "Building a gemini server in python",
  "url": "https://urgent.news/2026/11/02/building-a-gemini-server-in-python",
  "topic": "ai",
  "section": "AI",
  "published": "2026-11-02T11:25:16.000Z",
  "source": {
    "name": "Lobsters",
    "slug": "lobsters",
    "url": "https://www.willmunn.xyz/gemini/python/2026/10/16/we-have-lift-off.html"
  },
  "original_language": "en",
  "account": "The Gemini protocol emerged seven years ago as an alternative to the modern web, focusing on providing value to independent content creators without the distractions of the main web. It functions with a stripped-down format called gemtext, similar to markdown, and operates on a non-standard port (1965) to avoid confusion with existing web services. To set up a Gemini server in Python, you first create a TCP socket to listen on the appropriate port, using low-level APIs to bind the socket to '0.0.0.0' for listening on all network interfaces. After running the server, you can test it using a TCP client like telnet or nc to check if it correctly responds with 'Hello' to requests.\n\nGemini requests are simple, consisting of an absolute URL under 1024 bytes. The server responds with 'Hello' for the path '/hello' and '/goodbye' for the path '/goodbye'. For a fully functional Gemini server, it must use TLS encryption. Similar to the web, Gemini servers can use self-signed certificates with a \"Trust on first use\" (TOFU) policy. Generating a self-signed certificate using OpenSSL is straightforward and allows you to provide a unique TLS certificate for your server. By configuring your Python server to use this certificate, you enable encryption for secure Gemini communication.\n\nTo extend your server, you can add routes to handle user input. Gemini servers support status 10 to indicate that user input is required, prompting the client for a single text field in the same URI. Implementing a route to echo back user input demonstrates this functionality. For enhanced security, Gemini supports mutual TLS (mTLS), allowing both server and client to present their own TLS certificates, enabling client identification based on certificate authenticity. This process involves generating certificates for both parties and configuring your Python server to verify the client's certificate. Once configured, your Gemini server can securely serve content and accept user input, offering a minimalist yet robust alternative to the modern web.",
  "summary": null,
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}